How To Give Background Color In HTML?

Use the `bgcolor` attribute in older HTML:

``

Use inline CSS with the `style` attribute:

``

Set background color for a specific element:

`

Content

`

Use an internal CSS style rule:

`

`

Use an external CSS file:

`body { background-color: yellow; }`

Use color names:

`background-color: red;`

Use hexadecimal color codes:

`background-color: #ffcc00;`

Use RGB values:

`background-color: rgb(255, 204, 0);`

Use RGBA values:

`background-color: rgba(255, 204, 0, 0.5);`

Suggested for You

Trending Today