HOME | PHP Tutorial | CSS
facebook icon
HTML Tutorial

CSS Tutorial

HTML colors, text, background and border color

HTML colors are used to give a specific web page design, highlight certain words or paragraphs, a proper contrast, etc.
HTML colors are specified using color name, RGB, HEX, HSL, RGBA and HSLA value.

HTML colors specified by name for background of item

HTML colors are specified using predefined color names as: LightGrey, Gold, Tomato, Orange, Blue, DodgerBlue, Green, MediumSeaGreen, Gray, Blue, SlateBlue, Violet, LightGray, Black etc. In the next example we give background color for div box.

Example 1:
<div style="height:100px; width:250px; color:#000000; background:Gold"> background color for this box it is Gold</div>
<div style="height:100px; width:250px; color:#000000; background:DodgerBlue"> background color for this box it is DodgerBlue </div>
Note: HTML colors supports 140 standard color names.

Text color and border color

You can set up text color inside box with different background color and differen border.
<h1 style="color:Brown;">Hello World. This text is brown color</h1>
<p style="color:DarkCyan; border:2px blak;">Hello World. This text is DarkCyan color with blak color border</p>
<div style="color:DarkRed;">Hello World. This text is DarkRed color inside div box</div>
2. External style for html div text color.
Example 3: named index.html and we add external file named style.css in Example 4.
<link rel="stylesheet" type="text/css" href="style.css">
<div>this box is background-color:red, blak border with FloralWhite color text</div>
Example 4 named style.css
color: FloralWhite ;
border:2px blak;

HTML Color Values

The HTML div style class attribute is used to define equal styles for item with the same class name.
So, all HTML div style class item with the same attribute will have the same format and style.
Here we have three HTML <div> class elements that point to the same class name:
Example 5:
<h1 style="background-color:rgb(255, 99, 71);">...</h1>
<h1 style="background-color:#ff6347;">...</h1>
<h1 style="background-color:hsl(9, 100%, 64%);">...</h1>
The result:

The same background color but in different RGB values

The same background color but in different RGB values and different text color

The same background color but in different RGB values with different text color

HTML colors, Text color, Border Color, background color HTML colors, background, text and border color - html tutorial

2664. Links : How to Make a Link - HTML Tutorial
HTML links - HTML tutorial

3053. HTML Elements
Learn about HTML Elements with this HTML tutorial.

2189. HTML Tutorial - Eingabe-Tag, Text, Passwort, Checkbox, Option, absenden, Reset
Eingabe-Tag-Nutzung. Warum ist der Input-Tag so nützlich, um ein Formular zu erstellen.

2223. HTML Tutorial - Conclusion

2619. Basics : Body Section - HTML Tutorial
HTML basics - HTML tutorial

2117. HTML Tutorial - Hexadecimal, RGB color codes, inserting colors into html pages / safe colors
Hexadecimal colors and rgb colors. inserting colors

Your add here
How to get PHP errors to display?
How to prevent sql injection in php mysqli
How do I get PHP errors to display - PHP error_reporting()
mysql_query(): The mysql extension is deprecated and will be removed i
Function eregi_replace() is deprecated in php - How to fix
PHP delete an element from an array
Uncaught Error: Call to undefined function MYSQL_NUM_ROWS() in
Deprecated: mysql_connect() mysql extension is deprecated and will be
mysqli_fetch_array() expects parameter 1 to be mysqli_result boolean g
SQL IN Operator - example
SQL like syntax and example
SQL WHERE AND & OR multiple conditions
SQL create table primary key autoincrement
PHP mysqli_connect () Function
SQL COUNT(), AVG() and SUM() Functions
Display data from SQL database with MySQLi into php - html table
SQL mysql order by columns, by date, by asc, by desc, random with PHP
PHP mysqli_query() Function - mysqli query
SQL delete row - SQL delete table
SQL update - SQL update select
Insert into SQL - Insert into table SQL - Insert data in sql
Login in PHP - simple login script with PHP MYSQL