I have a block with a certain line-height, where I insert content with the ::before pseudo element.
.block::before {
content:'text here';
}
This works well. However, if I also give the content a smaller font size
.block::before {
font-size:.6em;
content:'text here';
}
the block actually becomes higher. Why is that?
.container {
display:inline-block;
}
.lorem, .ipsum, .dolor, .sit {
line-height:3em; border:1px solid green
}
.ipsum:before {
content:'world!';
}
.sit:before {
font-size:.6em;
content:'world!';
}
<div class="container">
<div class="lorem">Hello</div>
</div>
<div class="container">
<div class="ipsum"></div>
</div>
<hr style="clear:both"/>
<div class="container">
<div class="dolor">Hello</div>
</div>
<div class="container">
<div class="sit"></div>
</div>
The top row doesn't have font size changes, the bottom row does.
Now I found out that a possible solution is to set the line-height of the pseudo element to 0. Or to 1em. Or even to normal. So what is going on? Is the line-height set to some weird value by setting the font size to .6em? Why?
PS Although this looks like a duplicate (see the list to the right), none of the answers I've read so far explains why setting line-height:normal solves the issue. There must be something happening that sets the line-height to a greater value implicitly. And that's what I'm trying to find out.
Edit: This question has had quite a number of new eyeballs lately, so here's an update to make it more useful.
Alohci's solution is correct, but it may not be absolutely clear for the more graphically-inclined.
So allow me to clarify the solution a bit, with pictures.
First, the line-height is inherited as its calculated size, so although it's specified in em units, children will inherit value in pixels. For example, with a font size of 20px and a line height of 3em, the line height will be 60 pixels, even for descendants with different font sizes (unless they specify their own line heights).
Now let's assume a font with a 1/4 descender. That is, if you have a 20px font, the descender is 5 pixels and the ascender 15 pixels. The remaining line-height (in this case, 40 pixels) is then divided equally above and below the baseline, like this.
For the block with the smaller font (0.6em or 12 pixels), the remaining amount of line-height is 60-12 or 48 pixels, which also gets divided equally: 24 above and 24 below the baseline.
Then if we combine the two fonts on the same baseline, you will see that the line heights are not divided in the same way, so the total height of the containing block increases, even though both line heights are 60 pixels.
Hope this explains things!
The height of the .lorem, .ipsum, .dolor, and .sit boxes is each the height of the single line box that they contain.
The height of each line box is the maximum of the height above the baseline + the maximum height below the baseline of the strut of the line and the text in the line. since the strut and the text are aligned on the baseline.
For clarity, heights below in em, refer to the font size of the overall container (i.e. the body element)
In .ipsum, (where the font size is 1em) the height above the baseline is 1em (the upper half-leading) + 13/16em (the ascender, approx) for both the strut and the text, and the height below the baseline is 1em (the half-leading) + 3/16em (the descender, approx) + 1em (the lower half-leading) making a total of 3em.
In .sit (where the font size is 0.6em) the height above the baseline is the maximum of [1em (the upper half-leading) + 13/16em (the ascender, approx) for the strut] and [1.2em (the upper half-leading) + 0.6 x 13/16em (the ascender, approx) for the text], and the height below the baseline is the maximum of [1em (the lower half-leading) + 3/16em (the descender, approx) for the strut] and [1.2em (the lower half-leading) + 0.6 x 3/16em (the descender, approx) for the text].
Evaluating that and converting to decimal gives 1.8125em above the baseline and 1.3125em below the baseline making a total of 3.125em, which is larger that the 3em of .ipsum.
Since there are already two answers that explain well why the height is increased, to quickly fix this problem you simply need to remove the units in line-height.
.lorem, .ipsum, .dolor, .sit {
line-height:3; border:1px solid green;
}
According to MDN
The line-height CSS property sets the height of a line box. It's
commonly used to set the distance between lines of text. On
block-level elements, it specifies the minimum height of line boxes
within the element. On non-replaced inline elements, it specifies the
height that is used to calculate line box height.
Values
normal Depends on the user agent. Desktop browsers (including Firefox) use a default value of roughly 1.2, depending on the
element's font-family.
number (unitless) The used value is this unitless number multiplied by the element's own font size. The computed value is the
same as the specified number. In most cases, this is the preferred
way to set line-height and avoid unexpected results due to
inheritance.
length The specified length is used in the calculation of the line box height. Values given in em units may produce unexpected results.
percentage Relative to the font size of the element itself. The computed value is this percentage multiplied by the element's
computed font size. Percentage values may produce unexpected results.
So basically your question is one of the cases of unexpected results due to inheritance.
.container {
display:inline-block;
}
.lorem, .ipsum, .dolor, .sit {
line-height:3; border:1px solid green;
}
.ipsum:before {
content:'world!';
}
.sit:before {
font-size:.6rem;
content:'world!';
}
<div class="container">
<div class="lorem">Hello</div>
</div>
<div class="container">
<div class="ipsum"></div>
</div>
<hr style="clear:both"/>
<div class="container">
<div class="dolor">Hello</div>
</div>
<div class="container">
<div class="sit"></div>
</div>
Hi please add a specific height on your box...
.lorem, .ipsum, .dolor, .sit {
border:1px solid green;
height:30px;/*changes*/
}
Fiddle :http://jsfiddle.net/jxf29/
The font property on .sit:before is affecting this, the content property of css follows the current elements' css properties very stricly,
Its because of this that you can be able to manipulate the value of the content property within the same style that the content property is created
e.g
sit {
color: green;
}
sit:before{
content: "text-here";
color: red;
}
this would emphasize the color to be red.
Related
I have a block with a certain line-height, where I insert content with the ::before pseudo element.
.block::before {
content:'text here';
}
This works well. However, if I also give the content a smaller font size
.block::before {
font-size:.6em;
content:'text here';
}
the block actually becomes higher. Why is that?
.container {
display:inline-block;
}
.lorem, .ipsum, .dolor, .sit {
line-height:3em; border:1px solid green
}
.ipsum:before {
content:'world!';
}
.sit:before {
font-size:.6em;
content:'world!';
}
<div class="container">
<div class="lorem">Hello</div>
</div>
<div class="container">
<div class="ipsum"></div>
</div>
<hr style="clear:both"/>
<div class="container">
<div class="dolor">Hello</div>
</div>
<div class="container">
<div class="sit"></div>
</div>
The top row doesn't have font size changes, the bottom row does.
Now I found out that a possible solution is to set the line-height of the pseudo element to 0. Or to 1em. Or even to normal. So what is going on? Is the line-height set to some weird value by setting the font size to .6em? Why?
PS Although this looks like a duplicate (see the list to the right), none of the answers I've read so far explains why setting line-height:normal solves the issue. There must be something happening that sets the line-height to a greater value implicitly. And that's what I'm trying to find out.
Edit: This question has had quite a number of new eyeballs lately, so here's an update to make it more useful.
Alohci's solution is correct, but it may not be absolutely clear for the more graphically-inclined.
So allow me to clarify the solution a bit, with pictures.
First, the line-height is inherited as its calculated size, so although it's specified in em units, children will inherit value in pixels. For example, with a font size of 20px and a line height of 3em, the line height will be 60 pixels, even for descendants with different font sizes (unless they specify their own line heights).
Now let's assume a font with a 1/4 descender. That is, if you have a 20px font, the descender is 5 pixels and the ascender 15 pixels. The remaining line-height (in this case, 40 pixels) is then divided equally above and below the baseline, like this.
For the block with the smaller font (0.6em or 12 pixels), the remaining amount of line-height is 60-12 or 48 pixels, which also gets divided equally: 24 above and 24 below the baseline.
Then if we combine the two fonts on the same baseline, you will see that the line heights are not divided in the same way, so the total height of the containing block increases, even though both line heights are 60 pixels.
Hope this explains things!
The height of the .lorem, .ipsum, .dolor, and .sit boxes is each the height of the single line box that they contain.
The height of each line box is the maximum of the height above the baseline + the maximum height below the baseline of the strut of the line and the text in the line. since the strut and the text are aligned on the baseline.
For clarity, heights below in em, refer to the font size of the overall container (i.e. the body element)
In .ipsum, (where the font size is 1em) the height above the baseline is 1em (the upper half-leading) + 13/16em (the ascender, approx) for both the strut and the text, and the height below the baseline is 1em (the half-leading) + 3/16em (the descender, approx) + 1em (the lower half-leading) making a total of 3em.
In .sit (where the font size is 0.6em) the height above the baseline is the maximum of [1em (the upper half-leading) + 13/16em (the ascender, approx) for the strut] and [1.2em (the upper half-leading) + 0.6 x 13/16em (the ascender, approx) for the text], and the height below the baseline is the maximum of [1em (the lower half-leading) + 3/16em (the descender, approx) for the strut] and [1.2em (the lower half-leading) + 0.6 x 3/16em (the descender, approx) for the text].
Evaluating that and converting to decimal gives 1.8125em above the baseline and 1.3125em below the baseline making a total of 3.125em, which is larger that the 3em of .ipsum.
Since there are already two answers that explain well why the height is increased, to quickly fix this problem you simply need to remove the units in line-height.
.lorem, .ipsum, .dolor, .sit {
line-height:3; border:1px solid green;
}
According to MDN
The line-height CSS property sets the height of a line box. It's
commonly used to set the distance between lines of text. On
block-level elements, it specifies the minimum height of line boxes
within the element. On non-replaced inline elements, it specifies the
height that is used to calculate line box height.
Values
normal Depends on the user agent. Desktop browsers (including Firefox) use a default value of roughly 1.2, depending on the
element's font-family.
number (unitless) The used value is this unitless number multiplied by the element's own font size. The computed value is the
same as the specified number. In most cases, this is the preferred
way to set line-height and avoid unexpected results due to
inheritance.
length The specified length is used in the calculation of the line box height. Values given in em units may produce unexpected results.
percentage Relative to the font size of the element itself. The computed value is this percentage multiplied by the element's
computed font size. Percentage values may produce unexpected results.
So basically your question is one of the cases of unexpected results due to inheritance.
.container {
display:inline-block;
}
.lorem, .ipsum, .dolor, .sit {
line-height:3; border:1px solid green;
}
.ipsum:before {
content:'world!';
}
.sit:before {
font-size:.6rem;
content:'world!';
}
<div class="container">
<div class="lorem">Hello</div>
</div>
<div class="container">
<div class="ipsum"></div>
</div>
<hr style="clear:both"/>
<div class="container">
<div class="dolor">Hello</div>
</div>
<div class="container">
<div class="sit"></div>
</div>
Hi please add a specific height on your box...
.lorem, .ipsum, .dolor, .sit {
border:1px solid green;
height:30px;/*changes*/
}
Fiddle :http://jsfiddle.net/jxf29/
The font property on .sit:before is affecting this, the content property of css follows the current elements' css properties very stricly,
Its because of this that you can be able to manipulate the value of the content property within the same style that the content property is created
e.g
sit {
color: green;
}
sit:before{
content: "text-here";
color: red;
}
this would emphasize the color to be red.
This has a demo:
<div style="position:absolute;">
<img
src="https://i.imgur.com/iQ2rVup.jpg"
style="width:100%;height:100px;"
/>
</div>
On Codepen
Chrome result:
Firefox/IE result:
I saw the W3C document.
Absolutely locate non-displaced elements are calculated as follows.
min(max(preferred minimum width, available width), preferred width)
https://www.w3.org/TR/CSS2/visudet.html#abs-non-replaced-width
Is the result of chrome wrong?
This will probably not answer the question but I will try to explain what is happening with chrome and why both can be correct.
First, you should notice that the same happen even if you consinder inline-block element or float as they are also shrink-to-fit elements
<div style="display:inline-block;">
<img
src="https://i.imgur.com/iQ2rVup.jpg"
style="width:100%;height:100px;"
/>
</div>
<br>
<div style="float:left;">
<img
src="https://i.imgur.com/iQ2rVup.jpg"
style="width:100%;height:100px;"
/>
</div>
Now it's all about the width:100%. Since it's a percentage value, the reference will be the width of the containing block but our containing block is a shrink-to-fit element which means that its width depend on its content. Here we have a kind of cycle.
Here is the part of the specification that describe such behavior:
Sometimes the size of a percentage-sized box’s containing block depends on the intrinsic size contribution of the box itself, creating a cyclic dependency. When calculating the containing block’s size, the percentage behaves as auto. Then, unless otherwise specified, when calculating the used sizes and positions of the containing block’s contents: ...
So basically, we consider the width of our image to be auto, we calculate the width of the div (parent element) and then we use width:100% again on that calculated width.
Here come the difference. Firefox is considering the height set to the image in the calculation to find the value of the width of the image (as described in this part of the specification). Now that we have the new width of the image, the parent element will shrint-to-fit this width and we will reconsider the width:100% again based on the previous width.
Chrome is setting the width to auto BUT is not considering the height and in this case the width will use the intrinsic dimension of the image to have the following:
<div style="display:inline-block;">
<img
src="https://i.imgur.com/iQ2rVup.jpg"
style="/*width:100%;height:100px;*/"
/>
</div>
Now that we have the new width, we can calculate the width of the parent element (shrink-to-fit) and now if we set width:100%;height:100px to the image we wil have 100px for height and 100% of the containing block width which is the initial image width.
Now the question is: should we consider the height to calculate the value of new width of the image when this one is considered as auto in order to calculate the width of the containing block? If no Chrome is correct, if yes Firefox is correct.
Worth to note that in both cases the image may get distored. We don't notice this on Firefox in the actual example because the height is small.
Here is an animation to illustrate the distortion and to show the different behavior between both browsers.
img {
width:100%;
height:200px;
}
.wrapper {
border:2px solid;
animation:change 5s linear infinite alternate;
}
.wrapper > div {
border:2px solid green;
}
#keyframes change {
from {
width:500px;
}
to {
width:100px;
}
}
<div class="wrapper">
<div style="display:inline-block;">
<img src="https://i.imgur.com/iQ2rVup.jpg" />
</div>
</div>
The wrapper here is used as the containing block of our shrink-to-fit element and will define the available width. We can clearly see that in Chrome the image is always distored and in Firefix the distortion will happen later.
I have trouble understanding the following excerpt from 10 Visual formatting model details
– W3C.
The excerpt:
baseline:
Align the baseline of the box with the baseline of the parent box. If the box does not have a baseline, align the bottom margin edge with the parent's baseline.
What does "the baseline of the parent box" mean in this context?
Does "parent box" refer to the line-box or the box established by the parent element? How do I calculate the "baseline of the parent box"?
Check the bottom of this answer for an interactive version of this answer which will help you to verify statements from this answer on your own. This answer has been based on the post by Vincent De Oliveira on his blog. It's a must-read.
What is baseline?
The image below, and many other images alike specify a basline, but what is it exactly?
Inline text elements are not the same height...
To measure the height of an inline text element I will use the term content-area. Content-area of these elements for Windows is calculated as follows:
Content-area=(Win Ascent + Win Descent)/Em Size * Font Size
See a few examples below:
Merriweather Sans has a content-area of 25px because (2014+560)/2048*20≈25px
Noto Sans has a content-area of 27px because (2189+600)/2048*20≈27px
You can find these values, for example, using FontForge, as shown on the screenshots below:
Merriweather Sans (right), Noto Sans (left)
In this case for each font we have [content-area]=[line-box] and this is a special case in which you can measure the content-area of the element with dev-tools:
How to align text elements to make text readable?
To do this you use the baseline.
In the example below you can see that increasing the line-height doesn't increase the content-box (the colored area), but it does increase the line-box of the orange inline element. Furthermore, notice that both elements are mutually aligned along their baseline. The baseline is defined by each font separately. However, when two different fonts align along their baseline, the resulting text is easily readable.
This is an image with the baseline showed as a green line:
In the example below, the orange element is aligned in respect to the top of the parent's content area. However, the tomato colored element is aligned in respect to the baseline of the strut of the parent. A strut is a zero-width character which starts the line-box of the parent.
It might seem that the tomato colored element has moved up, but it is not the case. Its position relative to the strut has not changed.
Conclusion
A baseline is a line which typeface authors use to design their fonts and make different fonts "mutually compatible". The baseline is chosen so that a text composed out of different fonts, which all have their own content-area, can be aligned along the baseline and remain easily readable.
A parent baseline is a baseline of the parent's strut, which is a zero-width character with a defined baseline which helps to align inline elements.
Interactive version of this answer
#import url('https://fonts.googleapis.com/css?family=Merriweather+Sans');
#import url('https://fonts.googleapis.com/css?family=Noto+Sans');
span {
margin: 0;
}
p.pr {
background-color: blue;
}
span.mw {
font-family: 'Merriweather Sans', sans-serif;
font-size: 20px;
line-height: 40px;
background-color: orange;
}
span.ar {
font-family: 'Noto Sans', sans-serif;
font-size: 20px;
background-color: tomato;
}
<h1>What is baseline?</h1>
The image below, and many other images alike specify a basline, but what is it exactly?
<img src="https://i.imgur.com/SJrxQHj.png">
<br><br>
<h1>Inline text elements are not the same height...</h1>
To measure the height of an inline text element I will use the term <b>content-area</b>. Content-area of these elements for windows is calculated as follows:
<p>Content-area=(Win Ascent + Win Descent)/Em Size * Font Size</p>
<p>See a few examples below:</p>
<ul>
<li>Merriweather Sans has a content-area of 25px because (2014+560)/2048*20≈25px <span class="mw">Abg</span></li>
<li>Noto Sans has a content-area of 27px because (2189+600)/2048*20≈27px <span class="ar">Abg</span></li>
</ul>
<p>You can find this values using for example FontForge, as shown on the screenshots below:</p>
<table>
<tr>
<td><img src="https://i.imgur.com/h0th3Rv.png"></td>
<td><img src="https://i.imgur.com/aRymbaf.png"></td>
</tr>
</table>
In this case for each font we have [content-area]=[line-box] and this is a special case in which you can measure the content-area of the element with dev-tools:
<img src="https://i.imgur.com/4kuFCIf.png">
<h1>How to align text elements to make text readable?</h1>
<p>To do this you use the baseline.</p>
In the example below you can see that increasing the line-height doesn't increase the content-box (the colored area), but it does increase the line-box of the orange inline element. Furthermore, notice that <b>both elements are mutually aligned along their baseline which is defined by the font itself.</b> The baseline is defined by each font separately. However, when two different fonts align along their baseline, the resulting text is easily readable.
<p class="pr">
<span class="mw">Abg (line-height=40px)</span><span class="ar">Abg</span>
</p>
This is an image with the baseline showed as a green line: <img src="https://i.imgur.com/OlHqb3J.png">
<br><br>
In the example below, the orange element is aligned in respect to the top of the parent's content area. However, the tomato colored element is aligned in respect to the baseline of the <b>strut</b> of the parent. A strut is a zero-width character which starts the line-box of the parent.
<br><br>
It might seem that the tomato colored element has moved up, but it is not the case. Its position relative to the strut has not changed.
<p class="pr">
<span class="mw" style="vertical-align:top;">Abg</span><span class="ar">Abg</span>
</p>
<h1>Conclusion</h1>
<p>A baseline is a line which typeface authors use to design their fonts. The baseline is chosen so that a text composed out of different fonts, which all have their own content-area, can be aligned along the baseline and remain easily readable.</p>
<p>A parent baseline is a baseline of the parent's strut, which is a zero-width character with a defined baseline which helps to align inline elements.</p>
The spec tells you what the parent box refers to just a couple of paragraphs above:
The following values only have meaning with respect to a parent inline element, or to the strut of a parent block container element.
So the parent box refers to the box generated by the parent element, and you calculate the baseline of the parent box just like you would any other element.
Neither did I find a specific definition,and according to the specification:
The following values only have meaning with respect to a parent inline element, or to the strut of a parent block container element
You can infer that ,if there is a text node as child in the parent box ,the baseline of the child text node is the baseline of the parent box.
For example:
.parent {
display: inline;
background:pink;
font-size:40px;
font-family:Microsoft Yahei;
line-height:2;
vertical-align:baseline;
}
.element-child {
font-size:25px;
}
<div class="parent">
textNode child of parent
<span class="element-child">
element-child with another font-size
</span>
</div>
Whatever with or without child text node,the baseline of parent box is in the same position which is equal to the baseline of the child text node.
Look at this picture to see what exactly is the baseline.
Now, let's demonstrate what the doc want to say:
When you define the vertical-align: baseline then the element is aligned to the baseline of the parent element's baseline as in the above picture.
I have a div 680 pixels wide where I want to show a number of thumbnails. Each thumb is 64 pixels wide and there's a margin of 24 pixels between them. Then 8 * 64 + 7 * 24 = 680. But the eighth thumb will also apply its margin, so that it doesn't fit anymore within the 680 pixels (8 * (64 + 24) = 704).
I fixed it by manually setting the margin of every other eighth thumb to 0, but I was wondering if CSS can handle this in a proper way.
Here's the code.
You can using the nth-child selector.
img:nth-child(8n) { margin:0 }
What you're saying here is: "For every 8th img-element, apply a margin of 0".
Here's your updated code - I also removed the inline CSS.
Take note this isn't supported by all browsers.
Using img:nth-child(8n) is correct answer but it will only work if we make another <div> surrounding thumbs and then apply margin: 12px 0 on every 8th child that is in this case also an 8th img-element.
The point is: it is not applying for every 8th img-element. This selector is selecting every 8th child element that is also an img. There is a subtle but important difference.
I.e. if in a container there is one paragraph and list of images then 8th image would not be selected with img:nth-child(8n) selector as it is not 8th child. In that case 7th img would be 8th child and thus selected. Here is example.
You can add a container around the thumbnails and specify a negative left margin on it, equal to the spacing, which in your case is 24px. Then simply add a left margin on all images. The container's negative margin would act like a gutter for the margin of the first image in each row ...
*Example CSS*
.thumbnailcontainer{
margin-left:-24px;
}
.thumbnail {
float:left;
margin: 8px 0px 8px 24px;
}
*Example HTML markup*
<div class="thumbnailcontainer">
<img src="thumb1" class="thumbnail">
<img src="thumb2" class="thumbnail">
<img src="thumb3" class="thumbnail">
....
</div>
I have the following div
<body>
<span style="border:1px solid red; display:inline-block">
Some text<br />
<hr />
some more text
</span>
</body>
In "normal" web browsers, the width of the div is calculated to fit the text. And the hr is 100% of the div.
But in IE7 the hr causes the div to expand to 100% of the body.
Is there any clever css I need to add somewhere so it behaves correctly in IE7?
Please note, I can't set any fixed width.
In IE6/7, display:inline-block only works on elements that are inline by default (e.g., span). So if you try setting a div to display:inline-block, it won't work in IE6/7.
An inline element will size itself to the width of its content. An inline-block element will do the same by default, if it's not given an explicit width. If the hr is 100% (100% of its parent, which in turn is 100% of the child), then there's a circular definition for the hr width that may not work as expected (100% of what? 100% of itself).
To avoid a circular definition for the width that may not work as expected in some browsers (especially IE6/7), either the container of the hr (div, span, or whatever) should have a defined width (in px, %, or em) or the hr itself should have an explicit width (in px or em). Otherwise, the width is not defined in any identifiable way, and it's left up to the browser to decide what to do by default.
If you can't set any widths, that may rule out using an hr tag. And based on the tests I ran, the options don't look very good for CSS solutions either (without setting a width).
Edit:
I think the only way to do this without setting widths or relying on JavaScript or jQuery, is if it's acceptable to have a horizontal line after every line of text (including any long paragraphs that wrap around to the next line, if there are any). In that case you could add a bg image to the container that contains a horizontal line at increments equal to the line-height of the text, displayed at a vertical offset equal to the line-height so a line doesn't appear at the top of the first line of text.
HTML
<div class="main">
<p>This is the first line.<br/>
This is the second line.<br/>
This is a long line that will wrap around to the next line if the container is not very wide.
</p>
</div>
CSS
.main {
background: url(image.png) repeat-x left 15px;
}
p {
font-size: 12px;
line-height: 15px;
}
jsfiddle demo
The width property of the <hr> tag has been deprecated, so you're styling options are limited on the <hr> tag.
15.3 Rules: the HR element
Index of Attributes
A more modern approach is to use the border property of a <div> instead.
Image rendered by IE 7:
Image rendered by Chrome 19:
jsFiddle Demo
HTML
<body>
<div style="border:1px solid red; float:left;">
<p>
Some text
</p>
<p class="border-top">
some more text
</p>
</div>
</body>
CSS
.border-top{
border-top:#000 1px solid;
padding-top:1em;
}
Note: IE 6 & 7 don't support display:inline-block, so you might need to use float:left instead. The article below compares the use of the aforementioned properties:
CSS display: inline-Block: Why It Rocks, And Why It Sucks
Found a method at a blog. The original one required modernizer.js. I've edited it.
HTML:
<div class="hrdemo"><hr /></div>
CSS:
.hrdemo hr {
display:none
}
However, if your div.hrdemo is inside some floated container; you may have to assign a fixed width for it (for IE7).