Chapter 2
CSS
IN THIS CHAPTER
Understanding the structure of a stylesheet
Using style classes
Separating stylesheets in files
Working with cascading stylesheets
Designing web pages with HyperText Markup Language (HTML) lets you create and display text that can be read through a browser on a variety of devices such as personal computers, mobile phones, and game consoles. However, changing the content on a web page often means changing the HTML code as well. Ideally, you want to leave the HTML code untouched and just change the content, much like pouring different liquids (such as coffee, juice, or milk) into a bottle so each type of liquid always appears in the shape of that bottle.
That’s the idea behind cascading stylesheets (CSS). First, you store different styles in a separate file or in a separate area in the same file, which contain instructions for formatting text. Second, you apply that stylesheet to a text file or text in that same file. The combination of the stylesheet file and the text creates the display of the web page inside a browser.
Cascading stylesheets get their ...
Get Beginning Programming All-in-One For Dummies, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.