How To Change P Element Text Color By Element Name Using CSS

admin_img Posted By Bajarangi soft , Posted On 28-10-2020

Using CSS we can change text color of html elements based on element names .So today we discuss how to do it in this article.

How To Change P Element Text Color By Element Name Using CSS

Step 1:Create Index.php file and implement below code.

 

<p>Hello World!</p>
<p>These paragraphs are styled with CSS.</p>



Step 2: Implement CSS to change text color.
 

<style>
    p{
        color: red;
        text-align: center;
    }
</style>



Complete Code To Change P Element Text Color By Element Name Using CSS.
 
<!DOCTYPE html>
<html>
<head>
    <title>How To Change P Element Text Color By Element Name Using CSS</title>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" />
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<style>
    body {
        background: pink;
    }
    p{
        color: red;
        text-align: center;
    }
</style>
<body>
<br /><br />
<div class="container">
    <br><br><br>
    <div class="text-center">
        <h1 id="color" style="color: black;">How To Change P Element Text Color By Element Name Using CSS</h1>
    </div>
    <br>
    <div class="well">
        <p>Hello World!</p>
        <p>These paragraphs are styled with CSS.</p>

    </div>
    <br>
</div>
</body>
</html>

Related Post