Redefining Elements

If you think you’re stuck with the official definitions of various elements in HTML, you’re wrong. With CSS, you can redefine any element to have the properties you desire. Don’t care for the Arial or Times New Roman fonts? No problem. You can substitute anything else for them if you like.

Take the H1 (major heading) element for example: Without CSS, it’s always going to have a size of 24 points, a black color, and a bold attribute. The H1 element will also be in Times New Roman font, even though many non-European publishers commonly use Arial for headings and Times New Roman for text. You’ll probably want to make such an obvious change, and CSS lets you do just exactly that. Here’s how you redefine it:

<HEAD>                                                        
						<STYLE>                                                       
						H1 {font-family:Arial, Helvetica, sans-serif}                 
						</STYLE>                                                      
						</HEAD>                                                       

Henceforth, every H1 element will have that value.

Get Building a Web Site For Dummies®, 3rd 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.