How To Specify a Background Image


How To Specify a Background Image? - CSS Tutorials - Page Layout and Background Image Design



The quickest way to specify a background image is to use the background-image style property. Let's try with an image from the Windows system called, follow.jpg:

The tutorial HTML and CSS document below adds a background image to the DIV tag:

<style type="text/css">
  BODY {background-color: gray; color: white} {background-image: url(follow.jpg); 
    width: 730px;  padding: 25px; text-align: left}
  HR {width: 730px}
  P {width: 730px; font-size: 28px}
  H1 {font-size: 32px}
</head><body><center><div class="page">
<img src=fyi_banner_blended.jpg width=728 width=90>
<H1>Background Image Repeated</H1>
<hr align=left>
<p><script language="JavaScript">
  for (i=0; i<10; i++) {
    for (j=0; j<24; j++) {
      document.write(j+' ');
<p align="right">By</p>

View the document in any browser, you will get something like:

2007-05-11, 4563👍, 0💬