gitter1226
May 1st, 2008, 12:35 PM
I am having problems with layout using CSS. I have an unknown number of divs, each with a background-image and an anchor element inside them. What I want is for the divs to be laid out left to right. So I used
.container
{
display : inline;
}
This does exactly what I want, lays them out left to right and wraps them to the next line if it fills up the page. However, if an anchor is too long, it is wrapping halfway through the anchor. To fix this I use :
a
{
white-space : nowrap;
}
I have used that property in the past with success. However, now it appears to be cancelling the nice wrapping effect completely. My inline divs now flow off the page and require the user to scroll to the right to see them all. Do white-space : nowrap and display : inline not play nice together?
I'm sure this is a browser-rendering issue, but I'm surprised that I'm having this problem in both IE7 and Firefox. Does anyone else have any suggestions on another way I can do this?
.container
{
display : inline;
}
This does exactly what I want, lays them out left to right and wraps them to the next line if it fills up the page. However, if an anchor is too long, it is wrapping halfway through the anchor. To fix this I use :
a
{
white-space : nowrap;
}
I have used that property in the past with success. However, now it appears to be cancelling the nice wrapping effect completely. My inline divs now flow off the page and require the user to scroll to the right to see them all. Do white-space : nowrap and display : inline not play nice together?
I'm sure this is a browser-rendering issue, but I'm surprised that I'm having this problem in both IE7 and Firefox. Does anyone else have any suggestions on another way I can do this?