fulio pen said:
Dear Sirs,
Thanks a lot for your help. Following is the web page which is exactly
what I need thus far. I will study the code carefully. SPANs are
definitely needed, but I have to learn how to use them.
http://www.pinyinology.com/zianpan/design/dorayme2b.html
All you need to do for this is change the children of the two
container DIVs of class "littleboxes" to SPANs, simply substitute
"span" for "div" for these.
.littleboxes {
margin-bottom: 1em;
overflow: hidden;
font-size: 2em;
line-height: 1em;
}
.littleboxes span {
float: left;
border: 1px solid red;
width: 1em;
height: 1em;
padding: .2em;
margin-right: .5em;
text-align: center;
}
<div class="littleboxes">
<span>a</span>
<span>b</span>
<span>c</span>
<span>d</span>
</div>
<div class="littleboxes">
<span>w</span>
<span>x</span>
<span>y</span>
<span>z</span>
</div>
The one practical advantage (apart from the spiritual one I mentioned
before) is that it will look more like you want it to look if a user's
browser does not use the CSS. The SPAN is an inline element, it is
styled by default to be displayed as inline. The DIV, on the other
hand, is a block element and will naturally divide the two blocks of
four letters onto two lines (as you seem to want).
If you do use SPANs, you don't particularly need to float. One of the
functions of your original floats was to force the block element of
DIV to go side by side with others. You could instead just:
.littleboxes {
margin-bottom: 1em;
overflow: hidden;
font-size: 2em;
}
.littleboxes span {
border: 1px solid red;
width: 1em;
height: 1em;
padding: 0 .2em 0 .2em;
margin-right: .5em;
text-align: center;
}