Forum Moderators: not2easy
Titel: a titel
Artist: an artist
Release Date: a release date
This layout comes next to an image on the rightside.
And I want to give the left-side of the layout (titel, artist, release date) a fixed width, so that it alignes out.
I have tried it with lists en floats, but it doesn't seem to work. I think the best way is to do it with floats.
Does anyone know a good way for this?
This is what I'd do.
<img style="float: right;" />
<div style="width: 50%;">
<ul>
<li>Titel: a titel</li>
<li>Artist: an artist</li>
<li>Release Date: a release date</li>
</ul>
</div>
<div style="clear: both;"> </div>
Then repeat.
It doesn't seem to listen when I say width: 100px;
When I make it an inline or a block-level element, the browser won't listen. Strange enough, only IE5/Win listens.
And this is my HTML code now:
<div class="productinfo">
<div class="rowproductinfo">
<span class="left">titel</span>
<span class="right">EXAMPLE TITLE</span>
</div>
<div class="rowproductinfo">
<span class="left">artiest</span>
<span class="right">Various Artists</span>
</div>
</div>
BUT, the span.left just doesn't want to be 100px wide.
I've only actually tested the two things above, very briefly.
<img style="float: right;" />
<div style="width: 50%;">
<ul>
<li><span style="width: 100px;">Titel:</span> a titel</li>
<li><span style="width: 100px;">Artist:</span> an artist</li>
<li><span style="width: 100px;">Release Date:</span> a release date</li>
</ul>
</div><div style="clear: both;"> </div>
My CSS code is as follows:
div.productinfo {
margin: 0px;
padding: 0px;
border: 1px dashed #000;
background-color: #666;
}
div.rowproductinfo {
margin-bottom: 25px;
}
div.rowproductinfo span.left {
margin: 0px;
padding: 0px;
float: left;
background-color: #f00;
width: 100px;
text-transform: uppercase;
}
div.rowproductinfo span.right {
float: left;
background-color: #fff;
}
And my html code is:
<div class="rowproductinfo">
<span class="left">titel</span>
<span class="right">TEST TITLE</span>
</div>
<div class="rowproductinfo">
<span class="left">artiest</span>
<span class="right">TEST ARTIST</span>
</div>
<div class="rowproductinfo">
<span class="left">release datum</span>
<span class="right">TEST RELEASE DATE</span>
</div>
In Mozilla and Opera the widths are all correct 100px, and the div.rowproductinfo are all below each other. Only in IE6 it puts 2 below each other but the rest of the div.productinfo's it ignores it. And in IE5 it doesn't at all.
Does anyone know how to fix this in IE?
I used a containerDIV called div.productinfo. At the beginning and the end of this containerDIV I used a spacerDIV.
<div class="productinfo">
<div class="spacer"></div>
-----
content
-----
<div class="spacer"></div>
</div>
In the spacerDIV is the code: clear: both;.
This is so that the div.productinfo contains the floatingDIVS. This is a hack, but now I need a hack for a hack?
Only in IE5 and IE6/Win there is a gap on the top and the bottom. Afcourse in Mozilla and Opera it is all correct.