Book Image

Responsive Web Design with HTML5 and CSS3, Second Edition

By : Ben Frain
5 (1)
Book Image

Responsive Web Design with HTML5 and CSS3, Second Edition

5 (1)
By: Ben Frain

Overview of this book

Table of Contents (17 chapters)
Responsive Web Design with HTML5 and CSS3 Second Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Use the simplest code possible


It's easy to get drunk on the power that new techniques afford us. With this in mind, aim to solve your responsive problems in the simplest manner possible. For example, if you need to style the fifth item in a list of items and you have access to the markup, don't use an nth-child selector like this:

.list-item:nth-child(5) {
    /* Styles */
}

If you have access to the markup, make life easier by adding an HTML class to the item:

<li class="list-item specific-class">Item</li>

And then style the item with that simple class:

.specific-class {
    /* Styles */
}

Not only is this easier to understand, it gets you wider support for free (older versions of Internet Explorer don't support nth-child selectors).