Style all <p> elements with class certain class name - HTML CSS CSS Selector

HTML CSS examples for CSS Selector:checked

Description

Style all <p> elements with class certain class name

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<head>
<style>
p.center {
    text-align: center;
    color: red;
}

p.large {<!--from  w w  w . j  a  va 2 s .com-->
    font-size: 300%;
}
</style>
</head>
<body>

<h1 class="center">This heading will not be affected</h1>
<p class="center">This paragraph will be red and center-aligned.</p>

</body>
</html>

Related Tutorials