In this tutorial you will learn about the HTML Backgrounds and its application with practical example.
HTML Backgrounds gives us a way to set background image for HTML elements like – HTML Table.
We can set various type of background like solid color, transparent background, gradient etc.HTML Backgrounds grow or shrink dynamically as the HTML element grows or shrinks.
Example:
1 2 3 4 |
<table height="100" width="150" background="w3school-logo.jpg" > <tr><td>This table with background image</td></tr> </table> |
Output:
Repeating Background
Sometimes when we use a image for the background we get into trouble when HTML element’s height or width grows comparatively to the background image. In this case we can repeat the background image in X or Y direction.