In this chapter in the Bulletproof Web Design book, we rebuild a box containing three images, a title, and a description.
HTML code:
In the code example above, you can see how the markup is organized by the divs surrounding the images
and descriptions. This example is used to show how to organize this and make it bulletproof with as
minimial code as possible. The images are also being identifyed.
CSS example: #sweden {
float: left;
width: 304px;
padding: 10px 0;
border: 2px solid #C8Cdd2;
background: url(img/bg.gif) no-repeat top right;
}
#sweden dl {
float: left;
width: 260px;
margin: 10px 20px;
padding: 0;
display: inline; /* fixes IE/Win double margin bug */
}
#header:after,
#sweden dl:after {
content: ".";
display: block;
height: 0;
clear: both;
visibility: hidden;
}
*html #header,
* html #sweden dl { height: 1% } /* ie 5 6*/
*:first-child+html #header,
*:first-child+html #sweden dl { min-height: 1px; } /*ie 7*/
#sweden dt {
float: right;
width: 162px;
margin: 0;
padding: 0;
font-size: 130%;
letter-spacing: 1px;
color: #627081;
}
#sweden dd {
margin: 0;
padding: 0;
font-size: 85%;
line-height: 1.5em;
color: #666;
}
#sweden dd.img img {
float: left;
margin: 0 8px 0 0;
padding: 4px;
border: 1px solid #D9E0E6;
border-bottom-color: #C8CDD2;
border-right-color: #C8CDD2;
background: #fff;
}
/*Reverse float*/
#sweden .alt dt {
float: left;
}
#sweden .alt dd.img img {
float: right;
margin: 0 0 0 8px;
}
In the CSS example above, you can see that the container is being styled. Also, the text and images
are being organized in that container. Notice the padding(border) around the images as well. \
Here is the final result:
http://tsouzasf.aisites.com/chapter4As you can see, there is a green background in the container with a gradient. To do this, I created a
green background in photoshop, and set up a gradient to make a style for the background. As you can
see, the ID "#Sweden" has the code. background: url(img/bg); This is in the CSS.