Multiple Style Rules

Multiple style rules can be applied within the declaration block by ensuring each style declaration terminates with a semi-colon ;

 

The declarations can be placed on single or separate lines:

<!DOCTYPE html>
<html>
	<head>
		<title>Document Title</title>
		<style>
			h1 { color: #F00; font-size: 2em; text-decoration: underline;}
			p { color: #00F;
				font-weight: bold;
				font-size: 10px;
			  }
		</style>
	</head>
	<body>
		<h1>A fantastic heading styled on a single line.</h1>
		<p>A paragraph styled over multiple lines.</p>
	</body>
</html>

Save & refresh browser:

A fantastic heading styled on a single line.

A paragraph styled over multiple lines.

Leave a Reply