Friday, February 6, 2015

Color in html

Background color 

Background color or just bgcolor as attribute is used for changing of color for background of whole HTML page or separate parts like tables. Bgcolor could be set on differ  places in HTML elements but it is suggested that you use bgcolor tag for whole page background and for tables CSS should be used. 



Here is an example how to change background color on your page:

<body bgcolor="blue">
Background color is set.
</body>



HTML system of colors - color names

Here is something about colors you can use in HTML. There are 3 different ways how to setup background colors. Easiest and most common way is to set one of most used colors. (example: blue, green, red, silver, black, yellow...)

Here are 16 basic colors:







Other way is hexadecimal way for coloring. Here is an example:

<body bgcolor="#006699">
Background color is set.
</body>



Third way for coloring includes RGB values:

<body bgcolor="rgb(0,0,255)">
Background color is set.
</body>


Third way for background color is not recommendable.


Here is an example for background color for table

<table bgcolor="#006699" border="1">
<tr>
<td>A shade of blue</td>
</tr>
</table>

With this knowledge you can change your background color, color of parts of your page or tables. Feel free to learn various methods and apply them in every way you need.

Image as background 

Background image could be used for all kinds of elements (tables, segments, body etc). You can use HTML to make image as a background but usually you should do it in CSS, when you learn it.

Here is an example how to setup image as background in separate table using HTML. 

<table height="300" width="420" background="http://www.psd-wordpress.blogspot.com/Images/image.png" >
<tr>
<td>This table has background image</td>
</tr>
</table>


For background images, due to differ sizes of images, you should use Patterneo or some other program that will fully fit your image to background.

No comments:

Post a Comment