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 a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing
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 : 9781839211560
Languages :
Concepts :

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing

Product Details

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

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

What is included in a Packt subscription? Chevron down icon Chevron up icon

A subscription provides you with full access to view all Packt and licnesed content online, this includes exclusive access to Early Access titles. Depending on the tier chosen you can also earn credits and discounts to use for owning content

How can I cancel my subscription? Chevron down icon Chevron up icon

To cancel your subscription with us simply go to the account page - found in the top right of the page or at https://subscription.packtpub.com/my-account/subscription - From here you will see the ‘cancel subscription’ button in the grey box with your subscription information in.

What are credits? Chevron down icon Chevron up icon

Credits can be earned from reading 40 section of any title within the payment cycle - a month starting from the day of subscription payment. You also earn a Credit every month if you subscribe to our annual or 18 month plans. Credits can be used to buy books DRM free, the same way that you would pay for a book. Your credits can be found in the subscription homepage - subscription.packtpub.com - clicking on ‘the my’ library dropdown and selecting ‘credits’.

What happens if an Early Access Course is cancelled? Chevron down icon Chevron up icon

Projects are rarely cancelled, but sometimes it's unavoidable. If an Early Access course is cancelled or excessively delayed, you can exchange your purchase for another course. For further details, please contact us here.

Where can I send feedback about an Early Access title? Chevron down icon Chevron up icon

If you have any feedback about the product you're reading, or Early Access in general, then please fill out a contact form here and we'll make sure the feedback gets to the right team. 

Can I download the code files for Early Access titles? Chevron down icon Chevron up icon

We try to ensure that all books in Early Access have code available to use, download, and fork on GitHub. This helps us be more agile in the development of the book, and helps keep the often changing code base of new versions and new technologies as up to date as possible. Unfortunately, however, there will be rare cases when it is not possible for us to have downloadable code samples available until publication.

When we publish the book, the code files will also be available to download from the Packt website.

How accurate is the publication date? Chevron down icon Chevron up icon

The publication date is as accurate as we can be at any point in the project. Unfortunately, delays can happen. Often those delays are out of our control, such as changes to the technology code base or delays in the tech release. We do our best to give you an accurate estimate of the publication date at any given time, and as more chapters are delivered, the more accurate the delivery date will become.

How will I know when new chapters are ready? Chevron down icon Chevron up icon

We'll let you know every time there has been an update to a course that you've bought in Early Access. You'll get an email to let you know there has been a new chapter, or a change to a previous chapter. The new chapters are automatically added to your account, so you can also check back there any time you're ready and download or read them online.

I am a Packt subscriber, do I get Early Access? Chevron down icon Chevron up icon

Yes, all Early Access content is fully available through your subscription. You will need to have a paid for or active trial subscription in order to access all titles.

How is Early Access delivered? Chevron down icon Chevron up icon

Early Access is currently only available as a PDF or through our online reader. As we make changes or add new chapters, the files in your Packt account will be updated so you can download them again or view them online immediately.

How do I buy Early Access content? Chevron down icon Chevron up icon

Early Access is a way of us getting our content to you quicker, but the method of buying the Early Access course is still the same. Just find the course you want to buy, go through the check-out steps, and you’ll get a confirmation email from us with information and a link to the relevant Early Access courses.

What is Early Access? Chevron down icon Chevron up icon

Keeping up to date with the latest technology is difficult; new versions, new frameworks, new techniques. This feature gives you a head-start to our content, as it's being created. With Early Access you'll receive each chapter as it's written, and get regular updates throughout the product's development, as well as the final course as soon as it's ready.We created Early Access as a means of giving you the information you need, as soon as it's available. As we go through the process of developing a course, 99% of it can be ready but we can't publish until that last 1% falls in to place. Early Access helps to unlock the potential of our content early, to help you start your learning when you need it most. You not only get access to every chapter as it's delivered, edited, and updated, but you'll also get the finalized, DRM-free product to download in any format you want when it's published. As a member of Packt, you'll also be eligible for our exclusive offers, including a free course every day, and discounts on new and popular titles.