How To Set HEX Colors Value For HTML Element Using CSS

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

In CSS, a color can be specified using a hexadecimal value in the form: #rrggbb Where rr (red), gg (green) and bb (blue) are hexadecimal values between 00 and ff (same as decimal 0-255).

How To Set HEX Colors Value For HTML Element Using CSS

Create index.html file and implement as below code in it.

<h1 style="background-color:#ee82ee;">#ee82ee</h1>
<h1 style="background-color:#ffa500;">#ffa500</h1>
<h1 style="background-color:#6a5acd;">#6a5acd</h1>
<h1 style="background-color:#ff0000;">#ff0000</h1>
<h1 style="background-color:#0000ff;">#0000ff</h1>
<h1 style="background-color:#3cb371;">#3cb371</h1>


Complete Code For Setting The Color Of Text Using Cascading Style Sheets
 

<!DOCTYPE html>
<html>
<head>
    <title>How To Set HEX Colors Value For HTML Element 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: black;
    }
</style>
<body>
<br/><br/>
<div class="container">
    <br><br><br>
    <div class="text-center">
        <h1 id="color" style="color: white;">Set HEX Colors Value For HTML Element Using CSS</h1>
    </div>
    <br>
    <div class="well">
        <h1 style="background-color:#ee82ee;">#ee82ee</h1>
        <h1 style="background-color:#ffa500;">#ffa500</h1>
        <h1 style="background-color:#6a5acd;">#6a5acd</h1>
        <h1 style="background-color:#ff0000;">#ff0000</h1>
        <h1 style="background-color:#0000ff;">#0000ff</h1>
        <h1 style="background-color:#3cb371;">#3cb371</h1>
    </div>
    <br>
</div>
</body>
</html>

Related Post