Set a Background Image
By Stephen Bucaro
Use the background-image property with the url method to set the background color for an element.
Set a Background Image for a Div
Download Free Ebooks at bucarotechelp.com
<span style="background-image: url('path/imagename')">Download Free Ebooks at bucarotechelp.com</span>
Set a Background Image for a Webpage
<body style="background-image: url('path/imagename')">
The default background attachment is for the background image to scroll with the webpage,
but you can set the background-attachment property to fixed to make the
background image remain fixed while the other elements on the webpage scroll:
<body style="background-image: url('path/imagename'); background-attachment: fixed;">
Set a Background Image for a Form
<form style="border-style:solid; border-width:1px; width:300px; background-image: url('path/imagename');">
Password: <input type="text">
<input type="button" value="Submit" onclick="javascript:return false;">
</form>
Repeat a Background Image Horizontally or Vertically
Use the background-repeat property to set a background image to be
repeated. background-repeat may be set to the following values.
no-repeat | background image will be displayed only once |
repeat-x | background image will be repeated horizontally |
repeat-y | background image will be repeated vertically |
repeat | background image will be repeated horizontally and vertically |
Download Free Ebooks at bucarotechelp.com
Download Free Ebooks at bucarotechelp.com
Download Free Ebooks at bucarotechelp.com
<span style="background-image:url('path/imagename.jpg'); background-repeat:repeat-y;">
Download Free Ebooks at bucarotechelp.com<br />
Download Free Ebooks at bucarotechelp.com<br />
Download Free Ebooks at bucarotechelp.com</span>
More CSS Quick Reference: • Set the border-collapse • Set the Text Color • Highlight Text • Set an Element's Float • Style the First Line • Set a Fixed Background Image • Set a Background Image's Position • Vertical Align an Element • Set the Border Properties • Set the Background Color
|