Chapter 38. Using Background Images in CSS Divs

Background images in table cells are either there or not, as you saw in Topic 37. You either define them in the HTML, or you don't, and the browser takes care of the rest. If the amount of content in the table cell exceeds the physical size of the image, the browser tiles the image. If this is the effect you want, then good for you. If you don't want this effect, then too bad.

Not so with background images in CSS divs. CSS provides a number of design options. You may tile the image if you like in a variety of ways, or you may display it one time and one time only. You may also specify where in the div your background image should appear.

Start with a typical div, like this:

 <div id="mercury" style="width: ...

Get Web Design Garage now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.