CSS and HTML 5 – Tag Based Class Attributes

You can use Tag Elements with CSS Classes to create text with similar styling.

classTagStyle.css

.prettyText {
	color: orange;
	font-family: arial;

}

h1.prettyText {
	background-color: grey;

}

h2.prettyText {
	font-style: italic;
}

p.prettyText {
	text-decoration: underline;
}

classTag.html

<html>
<head>
<link rel="stylesheet" href="classTagStyle.css" />
</head>

<body>

<h1 class="prettyText">This is an H1</h1>
<h2 class="prettyText">This is an H2</h2>
<p class="prettyText"> Finally this is using a P tag</p>

<h3 class="prettyText">This prettyText H3 without additional format</h3>

<h3> This H3 has default formatting</h3>

</body>
</html>

Be the first to comment

Leave a Reply