background color attribute in html code example

Example 1: html background color

<html>
 
<body style="background-color:red;">
  <p> test <p/> 
  <body/>
  </html>

Example 2: how to make a background color in html

<body style="background-color: #fff">
  <!---this will change the body color---!>

</body>

Example 3: html how to change background color

<body style="background-color:powderblue;">
<p style="background-color:tomato;">This paragraph has a red background.</p>
</body>

Example 4: background color

//javascript type css:
document.body.style.backgroundColor = "blue";
// or inline css:
<div style="background-color: blue;"></div>

Example 5: html color changing background

@keyframes bgcolor {
    0% {
        background-color: #45a3e5
    }

    30% {
        background-color: #66bf39
    }

    60% {
        background-color: #eb670f
    }

    90% {
        background-color: #f35
    }

    100% {
        background-color: #864cbf
    }
}

body {
    -webkit-animation: bgcolor 20s infinite;
    animation: bgcolor 10s infinite;
    -webkit-animation-direction: alternate;
    animation-direction: alternate;
}

Tags:

Html Example