O'Reilly logo

The CSS3 Anthology, 4th Edition by Rachel Andrew

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 8CSS Positioning Basics

In this chapter, we will look in further depth at some of the vital concepts when positioning page elements using CSS. If you’re reading this book chapter by chapter, you’ll already have come across some of these concepts used in the examples. Here we’ll take a proper look at them, and see how they can be used in combination to layout our pages and components.

How do I decide when to use a class and when to use an ID?

At first glance, classes and IDs seem to be used in much the same way: you can assign CSS properties to both classes and IDs, and apply them to change the way HTML elements look. But in which circumstances are classes and IDs best applied?

Solution

The most important rule where classes and IDs ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required