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.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access