0

I was just doing basic stuff with CSS for learning purposes & changed the color of <p> but it changed partially (text color changed before h2). Is it because of <h2>? If Yes, then what's the reason behind it?

The CSS code is:

    h1{
        color: firebrick;}
    h2{
        color: #ffD700;}
    p.one{
        color: rgb(46, 7, 218);}

Corresponding HTML is:

<!DOCTYPE html>
<html>
<head>
    <title>Document</title>
    <link rel="stylesheet" href="style.css" type="text/css">
    </head>
    <body>
        <h1>Chapter 1</h1>
        <p class="one">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod 
             tempor incididunt ut labore
             et dolore magna aliqua. A scelerisque purus semper eget duis at tellus at urna.
            <h2>Chapter-1(Part-1)</h2> Diam volutpat commodo sed egestas egestas 
             fringilla. Urna nunc id cursus metus aliquam eleifend mi in.Nisi scelerisque eu 
             ultrices vitae auctor eu augue ut lectus. Id aliquet lectus proin nibh nisl 
             condimentum id venenatis.
        </p>
    </body>
    </html>

0 Answers0