Styling the Caption


The next step is to apply some basic styles to the caption text, starting with color.

There are many ways that the color white can be specified, including white, #fff, #ffffff, rgb(255,255,255), and rgb(100%,100%,100%). In this case, the three-digit hexadecimal option will be usedcolor: #fff.

Text can be aligned to the left, right, center, or justify. This caption will be centered using text-align: center as shown in Listing 11.5. The results can be seen in Figure 11.4.

Listing 11.5. CSS Code Styling the Caption
div.imagecaption {     float: right;     width: 182px;     margin: 0 1em 1em 1em;     display: inline;     padding: 10px 10px 70px 10px;     background: #036 url(chapter11.gif) repeat-x 0 100%;     color: #fff;     text-align: center; } 

Figure 11.4. Screenshot of styled caption.





Sams Teach Yourself CSS in 10 Minutes
Sams Teach Yourself CSS in 10 Minutes
ISBN: 0672327457
EAN: 2147483647
Year: 2005
Pages: 234
Authors: Russ Weakley

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net