CSS Tutorial





Español Français 中文 Deutsch Portuguese Japanese nederlands
   
 
CSS Topics
css tutorials Introduction
Types Types
Background Properties Background Properties
Text Properties Text Properties
Font Properties Font Properties
Box Properties BOX Properties
Border Properties Border Properties
Margin Properties Margin Properties
Padding Properties Padding Properties
Special Topics Special Topics
Forums Ask Your Doubts
Scraps More about CSS
Feedback Feedback
 




CSS Background Color


Tutorials Css

Topic

How to set the background color for html tags using style sheet?
How to assign background color for few words?




Explanation


Property: BackGround Color

Usage:
background-color: red;
background-color: #343434;
background-color: transparent;

Definition:

Background Color in html can be set using the css property background-color.
It accepts values in two formats

a) Color name
b) #xxyyz where xx,yy,zz points to hexadecimal values of red,green,blue
c) Transparent background can also be set in css.

Examples

Example 1:

<font style="background-color: green;"> color name </font>

Result:

color name


Example 2:

<font style="background-color: #888888;"> html text background using css</font>

Result:

html text background using css

Example 3:

<font style="background-color: transparent; color:green;"> transparent backgrounds can also be given using css</font>

Result:

transparent backgrounds can also be given using css


CSS Color Background image




A Note
CSS - Cascading Style Sheets can be used along with html tags as explained in this site. This simple CSS will help you to create much elegant and neat html web pages. This does not need any additional softwares or codings. All web browser are capable of handing CSS codes.

Note 2: If required you can using <span> instead of <div> tags. div tag will start and end on new lines. span will not exceed the tag area.
Other Links

web hosting