•  
     

class & id - HTML & CSS

index.html

Código: Selecionar todos

<!DOCTYPE html>
<html>
	<head>
		<link type="text/css" rel="stylesheet" href="stylesheet.css"/>
		<title>class & id - HTML & CSS</title>
	</head>
	<body>
		<h3 class="red">I'm an h3 header in the red class!</h3>
		<h3>I'm just a regular old h3 header.</h3>
		<p class="red">I'm a paragraph in the red class!</p>
		<p>I'm just a regular old paragraph.</p>
		<p id="rogue">I'm a rogue paragraph! I do what I want!</p>
	</body>
</html>


stylesheet.css

Código: Selecionar todos

.red {
	color: red;		<h3 class="red">I'm an h3 header in the red class!</h3>
		<h3>I'm just a regular old h3 header.</h3>
		<p class="red">I'm a paragraph in the red class!</p>
		<p>I'm just a regular old paragraph.</p>
		<p id="rogue">I'm a rogue paragraph! I do what I want!</p>
}

#rogue {
	color: #FF00FF;
	font-weight: bold;
	font-family: cursive;
}

Demo: http://jsfiddle.net/rjXxK/