CSS and HTML 5 – Tag Based Class Attributes

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


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


h1.prettyText {
	background-color: grey;


h2.prettyText {
	font-style: italic;

p.prettyText {
	text-decoration: underline;


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


<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>


Be the first to comment

Leave a Reply