Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Responsive Web Design with HTML5 and CSS
Responsive Web Design with HTML5 and CSS

Responsive Web Design with HTML5 and CSS: Develop future-proof responsive websites using the latest HTML5 and CSS techniques , Third Edition

eBook
$43.99 $62.99
Paperback
$78.99
Subscription
Free Trial
Renews at $19.99p/m

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning
Table of content icon View table of contents Preview book icon Preview Book

Responsive Web Design with HTML5 and CSS

Writing HTML Markup

HTML stands for Hypertext Markup Language. It is a language that allows content to be marked up in a manner that makes it more understandable to technology, and then in turn to humans.

You can have content on the web without CSS or without JavaScript. But you can't have content without HTML.

It's a common misconception that HTML is the easy part of authoring web pages and applications. Writing HTML is often dismissed out of hand as something anyone can do easily. My experience tells me HTML is easy to get wrong and not a lot else.

Also consider that for users of the web without sight or who have impaired vision, the way you author HTML can turn content from a confusing unusable mess, into a meaningful, useful, and delightful experience. Sighted users who rely on assistive technology for other reasons can also enjoy web pages far more easily if they have been marked up correctly.

Writing good quality HTML is not a specific need of responsive web design. It's far more important than that. It's a prerequisite of anything that you want to be accessible to all users of the web.

This chapter is therefore going to be about writing HTML markup. We will be considering the vocabulary of HTML, its semantics, or, more succinctly, the way we can use the elements of HTML to describe the content we place in markup.

HTML is what's known as a living standard. A few years back, the latest version was typically referred to as HTML5, a buzzword that helped identify modern web techniques and approaches. It's the reason this book is named "Responsive Web Design with HTML5 and CSS" instead of simply "Responsive Web Design with HTML and CSS." Back in 2012, you could more easily highlight that your techniques were modern by using the terms HTML5 and CSS3. As I write this in 2020, this distinction is less important. To read the living standard, head over here: http://www.w3.org/TR/html5/.

The topics we will cover in this chapter are:

  • Starting HTML pages correctly
  • The forgiving nature of HTML5 markup
  • Sectioning, grouping, and text-level elements
  • Putting HTML elements to use
  • WCAG accessibility conformance and WAI-ARIA for more accessible web applications
  • Embedding media
  • Responsive video and iframes

HTML also provides specific tools for handling forms and user input. This set of features takes much of the burden away from more resource heavy technologies like JavaScript for things like form validation. However, we're going to look at HTML forms separately in Chapter 10, Conquer Forms with HTML5 and CSS.

The basic structure of an HTML page is like this:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <title>Web Page Structure</title>
</head>
<body></body>
</html>

When writing HTML, you will typically be "marking up" or writing content inside a series of tags or elements. The majority of elements in HTML have an opening and closing tag. A few, like the preceding meta example, are void and hence "self-closing."

There's only a limited number of self-closing or void elements, defined here: https://html.spec.whatwg.org/multipage/syntax.html#void-elements.

They are referred to as void elements because they have no contents. Presently the void tags are area, base, br, col, embed, hr, img, input, link, meta, param, source, track, and wbr.

To exemplify the opening and closing nature of HTML tags, a paragraph of text would be most suitably marked up with an opening <p> at the beginning and a closing </p> at the end. Note the forward slash on the closing tag, as that's the differentiator between the opening and closing tags.

Although we are about to cover the head section, which is the content between the opening <head> and closing </head> tags, be aware that the lion's share of HTML authoring is done in the body section.

Getting the start of HTML pages right

We will begin at the start, which seems the logical place to start. Let's consider the opening elements of an HTML page and ensure we fully understand all the essential component parts.

Like so many things with the web, remembering the exact syntax of each thing inside the head section is not particularly important. Understanding what each thing is for is important, however. I generally copy and paste the opening code each time, or have it saved in a text snippet, and I would recommend you do too.

The first few lines of an HTML page should look something like this:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8" />

The doctype

So, what do we actually have there? First of all, we opened our document with the HTML5 Doctype declaration:

<!DOCTYPE html>

If you're a fan of lowercase, then <!doctype html> is just as good. It makes no difference.

The html tag and lang attribute

After the Doctype declaration, we open the html tag; the first and therefore root tag for our document. We also use the lang attribute to specify the language for the document, and then we open the <head> section:

<html lang="en">
<head>

Specifying alternate languages

According to the W3C specifications (http://www.w3.org/TR/html5/dom.html#the-lang-and-xml:lang-attributes), the lang attribute specifies the primary language for the element's contents and for any of the element's attributes that contain text. You can imagine how useful this will be to assistive technology such as screen readers. If you're not writing pages in English, you'd best specify the correct language code. For example, for Japanese, the HTML tag would be <html lang="ja">.

For a full list of languages, take a look at http://www.iana.org/assignments/language-subtag-registry.

Character encoding

Finally, we specify the character encoding, which in simple terms tells the browser how to parse the information contained within. As the meta tag is a void element, it doesn't require a closing tag:

<meta charset="utf-8" />

Unless you have a good reason to specify otherwise, the value for the charset is always utf-8.

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Understand what responsive web design is and its significance for modern web development
  • Explore the latest developments in responsive web design including variable fonts, CSS Scroll Snap, and more
  • Get to grips with the uses and benefits of the new CSS Grid layout

Description

Responsive Web Design with HTML5 and CSS, Third Edition is a renewed and extended version of one of the most comprehensive and bestselling books on the latest HTML5 and CSS tools and techniques for responsive web design. Written in the author's signature friendly and informal style, this edition covers all the newest developments and improvements in responsive web design including better user accessibility, variable fonts and font loading, CSS Scroll Snap, and much, much more. With a new chapter dedicated to CSS Grid, you will understand how it differs from the Flexbox layout mechanism and when you should use one over the other. Furthermore, you will acquire practical knowledge of SVG, writing accessible HTML markup, creating stunning aesthetics and effects with CSS, applying transitions, transformations, and animations, integrating media queries, and more. The book concludes by exploring some exclusive tips and approaches for front-end development from the author. By the end of this book, you will not only have a comprehensive understanding of responsive web design and what is possible with the latest HTML5 and CSS, but also the knowledge of how to best implement each technique.

Who is this book for?

Are you a full-stack developer who needs to gem up on their front-end skills? Perhaps you work on the front-end and you need a definitive overview of all modern HTML and CSS has to offer? Maybe you have done a little website building but you need a deep understanding of responsive web designs and how to achieve them? This is a book for you! All you need to take advantage of this book is a working understanding of HTML and CSS. No JavaScript knowledge is needed.

What you will learn

  • Integrate CSS media queries into your designs; apply different styles to different devices
  • Load different sets of images depending upon screen size or resolution
  • Leverage the speed, semantics, and clean markup of accessible HTML patterns
  • Implement SVGs into your designs to provide resolution-independent images
  • Apply the latest features of CSS like custom properties, variable fonts, and CSS Grid
  • Add validation and interface elements like date and color pickers to HTML forms
  • Understand the multitude of ways to enhance interface elements with filters, shadows, animations, and more

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Apr 30, 2020
Length: 408 pages
Edition : 3rd
Language : English
ISBN-13 : 9781839219795
Languages :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning

Product Details

Publication date : Apr 30, 2020
Length: 408 pages
Edition : 3rd
Language : English
ISBN-13 : 9781839219795
Languages :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total $ 172.97
Responsive Web Design with HTML5 and CSS
$78.99
Node.js Web Development
$43.99
40 Algorithms Every Programmer Should Know
$49.99
Total $ 172.97 Stars icon

Table of Contents

13 Chapters
The Essentials of Responsive Web Design Chevron down icon Chevron up icon
Writing HTML Markup Chevron down icon Chevron up icon
Media Queries – Supporting Differing Viewports Chevron down icon Chevron up icon
Fluid Layout, Flexbox, and Responsive Images Chevron down icon Chevron up icon
Layout with CSS Grid Chevron down icon Chevron up icon
CSS Selectors, Typography, Color Modes, and More Chevron down icon Chevron up icon
Stunning Aesthetics with CSS Chevron down icon Chevron up icon
Using SVGs for Resolution Independence Chevron down icon Chevron up icon
Transitions, Transformations, and Animations Chevron down icon Chevron up icon
Conquer Forms with HTML5 and CSS Chevron down icon Chevron up icon
Bonus Techniques and Parting Advice Chevron down icon Chevron up icon
Other Books You May Enjoy Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Full star icon Full star icon Full star icon Full star icon Half star icon 4.4
(40 Ratings)
5 star 72.5%
4 star 7.5%
3 star 15%
2 star 0%
1 star 5%
Filter icon Filter
Top Reviews

Filter reviews by




coyote May 20, 2021
Full star icon Full star icon Full star icon Full star icon Full star icon 5
it's excellent, but fyi it's not a beginners' book
Amazon Verified review Amazon
Mike Oct 15, 2020
Full star icon Full star icon Full star icon Full star icon Full star icon 5
This book gives me the same feeling I had reading Zeldman's Designing With Web Standards back in 2003. It's easy to read with light humour, helpful pictures and code samples. But most importantly it's inspiring.I was the nuts at front-end development about 15 years ago. The way my work at a startup panned out I did a big front-end project about 10 years ago and that held up until the company was acquired. Having not kept up with things in the meantime I needed a way to bring my skills into the phone age. Now I'm confident I know what's what as I search for my next project.
Amazon Verified review Amazon
Dustin May 08, 2020
Full star icon Full star icon Full star icon Full star icon Full star icon 5
The book was quick and easy to read because it wasn't overly dense or technical. A few things to be aware of: This isn't for total beginners. You should have a decent understanding of HTML & CSS and how they are used to build websites. It doesn't show you how to build a website from A-to-Z and doesn't go into extreme depth on most topics. This book is aimed at people who already know the basics of HTML & CSS but want to get up to speed on the latest features available and the modern, professional way of using them. You should probably also be ok with doing additional research and experimentation on your own.What I liked the most:Flexbox and Grid weren't presented as new things you might want to maybe consider using. From the beginning they were treated as the current standard - the tools you should be using to build websites today.The copious links to sources and additional information - everything from official specifications to 3rd party blogs and posts on the author's website.There is plenty of opinionated advice & best practices offered throughout the book but especially in the final chapter on Bonus Techniques and Parting Advice. This is really what sets a good technical book apart from just reading the specifications / manual.Full disclosure: I received a PDF review copy of this book from the author & publisher for free.
Amazon Verified review Amazon
Kyle S Sep 01, 2020
Full star icon Full star icon Full star icon Full star icon Full star icon 5
A great and easy to read book. Not over complicating topics like many development books tend to do.Back to HTML and CSS!When I first started on the book, I expected just the basics but it quickly takes a dive into many great topics & chapters. The forms, flexbox, and CSS Grid chapters alone were worth it! Top that off with loads of info on animations, selectors, semantics, and more. Accompanied by a multitude of examples and links to help solidify the teachings. A+ work!I think this book would make a great addition to any developer's library and will be an incredibly informative read for those learning and/or looking to get a refresh on topics you have a brief knowledge of. Keep it close by for reference!
Amazon Verified review Amazon
Prof Rex Last Nov 03, 2020
Full star icon Full star icon Full star icon Full star icon Full star icon 5
A brilliant introduction to the new world of interactive and reactive web pages. Five stars are not enough.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.