Redefining HTML tags with CSS

CSS allows us to configure existing html tag properties

In this example we will use CSS to change the bold tag, b, so any bold text is also blue.

<head>
<style type="text/css">
b { color: blue; }
</style>
</head>
<body>Here is <b>some text</b></body>

In this example we change the background-color property for the paragraph tag, p.

<head>
<style type="text/css">
<!--
p { background-color:blue; color:yellow}
//-->
</style>
</head>
<body>
<p>Here is some text in the paragraph tags.</p>
</body>

Exercises - External CSS files and Redefined html tags

1. Create the file mystyle.css as below and call it as an External style sheet from your html page.

body {font-family: Arial, sans-serif; color: darkred; background-color: #e9e6d4; }
p {background-color:white; font-family: Arial, sans-serif;}
h1, h2, h3 { text-align: left; color: #0050B2; }

2. Here is a really silly exercise that demonstrates the power CSS has over html tags.
Redefine the bold tag so it no longer works. (hint: font-weight:normal;)