Contact Form

Name

Email *

Message *

Cari Blog Ini

Adding Background Color For Pages In Css

Colorizing Your Webpage

Multiple Methods of Adding Background Color

In the realm of web design, the judicious use of color can profoundly enhance the user experience. One fundamental aspect of web aesthetics is the ability to set a background color for a web page. This seemingly mundane task can be accomplished through various HTML and CSS techniques, each with its own nuances and advantages.

The HTML Approach

The HTML attribute "bgcolor" allows you to directly specify a background color for a web page. However, this method has fallen out of favor due to its limited support in modern browsers and potential accessibility concerns.

The CSS Approach

CSS (Cascading Style Sheets) offers a more versatile and widely supported approach to setting background colors. The "background-color" property is the primary means of achieving this effect. Additionally, CSS provides greater flexibility in terms of color specification, transparency, and gradient effects.

Example: Setting a Coral Background Using CSS

The following CSS code sets the background color of the entire web page to coral:

 body {   background-color: coral; } 


Comments