Book Image

Responsive Web Design with HTML5 and CSS3

By : Ben Frain
Book Image

Responsive Web Design with HTML5 and CSS3

By: Ben Frain

Overview of this book

Tablets, smart phones and even televisions are being used increasingly to view the web. There's never been a greater range of screen sizes and associated user experiences to consider. Web pages built to be responsive provide the best possible version of their content to match the viewing devices of not just today's devices but tomorrow's too.Learn how to design websites according to the new "responsive design"ù methodology, allowing a website to display beautifully on every screen size. Follow along, building and enhancing a responsive web design with HTML5 and CSS3. The book provides a practical understanding of these new technologies and techniques that are set to be the future of front-end web development. Starting with a static Photoshop composite, create a website with HTML5 and CSS3 which is flexible depending on the viewer's screen size.With HTML5, pages are leaner and more semantic. A fluid grid design and CSS3 media queries means designs can flex and adapt for any screen size. Beautiful backgrounds, box-shadows and animations will be added ñ all using the power, simplicity and flexibility of CSS3.Responsive web design with HTML5 and CSS3 provides the necessary knowledge to ensure your projects won't just be built "right" for today but also the future.
Table of Contents (16 chapters)
Responsive Web Design with HTML5 and CSS3
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Preface

If you think you need to create a "mobile" version of your website—think again! A responsive web design provides one design that looks great on smart phone, desktop, and everything in-between. It will effortlessly respond to the size of the user's screen, providing the best experience possible for both today's and tomorrow's devices.

This book provides a complete "how-to" of taking an existing fixed width design and making it responsive. Furthermore, it extends responsive design methodology by applying the latest and most useful techniques provided by HTML5 and CSS3, making the design leaner and more maintainable than ever before. It also explains common best-practice methods of writing and delivering code, images, and files.

If you can understand HTML and CSS, you can build a responsive web design.

What this book covers

Chapter 1, Getting Started with HTML5, CSS3, and Responsive Web Design, defines what responsive web design is, provides examples of responsive designs, and highlights the benefits and economies of using HTML5 and CSS3.

Chapter 2, Media Queries: Supporting Differing Viewports, explains what media queries are, how to write them, and how they can be applied to any design to adapt the CSS styles for a device's capabilities.

Chapter 3, Embracing Fluid Layouts, explains the benefits of a fluid layout and shows how to easily convert a current fixed-width design to a fluid layout or use a CSS framework to rapidly prototype a responsive design.

Chapter 4, HTML5 for Responsive Designs, explores the many benefits of coding with HTML5 (leaner code, semantic elements, offline caching, and WAI-ARIA for assistive technologies).

Chapter 5, CSS3: Selectors, Typography, and Color Modes, demonstrates the power of CSS3 selectors, allowing you to target and transform anything with ease. We also use CSS3 @font-face rules to create beautiful web typography and explain new CSS3 color modes such as RGB(A) and HSL(A).

Chapter 6, Stunning Aesthetics with CSS3, shows how to create text shadows, box shadows, and gradients with pure CSS3. We also cover how to add multiple background images and create icons with a font.

Chapter 7, CSS3 Transitions, Transformations, and Animations, covers how to create, animate, and transform on-screen elements with nothing more than CSS3.

Chapter 8, Conquer Forms with HTML5 and CSS3, illustrates how to implement cross-browser form techniques that work on everything from the latest smart phones to desktop browsers.

Chapter 9, Solving Cross-browser Responsive Challenges, explains how to make old Internet Explorer versions responsive, adapt a set of links to a menu on mobile devices, serve different content for high-resolution displays, and conditionally load assets with Modernizr.

What you need for this book

You'll need a good familiarity with HTML and CSS. A very basic understanding of JavaScript may also help. A good taste in films will also be beneficial.

Who this book is for

Are you writing two websites—one for mobile and one for larger displays? Or perhaps you've heard of "responsive design" but are unsure how to bring HTML5, CSS3, and responsive design together. If so, this book provides everything you need to take your web pages to the next level—before all your competitors do!

This book is aimed at web designers and web developers who currently build fixed-width websites with HTML 4.01 and CSS 2.1. This book explains how to build responsive websites with HTML5 and CSS3 that adapt to any screen size.

Conventions

In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.

Code words in text are shown as follows: "HTML5 also accepts a far slacker syntax to be considered "valid". For example, <sCRipt SrC=js/jquery-1.6.2.js></script> is just as valid as the prior example."

A block of code is set as follows:

<div class="header">
  <div class="navigation">
    <ul class="nav-list">
      <li><a href="#" title="Home">Home</a></li>
      <li><a href="#" title="About">About</a></li>
    </ul>
  </div> <!—end of navigation -->
</div> <!—end of header -->

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

#wrapper {
  margin-right: auto;
  margin-left: auto;
  width: 96%; /* Holding outermost DIV */
}

#header {
  margin-right: 10px;
  margin-left: 10px;
  width: 97.9166667%; /* 940 ÷ 960 */
}

New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "For example, the navigation menu doesn't alternate between red and black, the main THESE SHOULD HAVE WON button in the content area and the full info buttons from the sidebar are missing and the fonts are all a far cry from the ones shown in the graphic file".

Note

Warnings or important notes appear in a box like this.

Note

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply send an e-mail to , and mention the book title through the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/support, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website, or added to any list of existing errata, under the Errata section of that title.

Piracy

Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors, and our ability to bring you valuable content.

Questions

You can contact us at if you are having a problem with any aspect of the book, and we will do our best to address it.