Forum Moderators: not2easy
I'm a complete noob (hate that word) to rounded corner boxes and what have you so bare with me...
Basically i want to get away from using tables where possible and make everything CSS based. I created a special offer box a while ago and i've been trying to convert it over to CSS.
It's not displaying right and i can't seem to fix it. :$
There's two problems:
1) The bottom right corner graphic isn't where it should be.
2) The text isn't where it should be - it's indented.
Hope someone can help. :)
[edited by: tedster at 7:18 pm (utc) on Mar. 8, 2008]
--- HTML ---
<div class="offerBox">
<span class="TL"></span>
<p><b>Test Offer</b><br />
<br />
Three Ventian or Vertical Blinds for <b>£80</b> <br />
<br />
Offer subject to size and availability. Valid until 1st January 1970. <br />
<br />
For more information please call us. <br /></p>
<span class="BR"></span>
</div>
--- CSS ---
.offerBox
{
margin: 0 auto;
padding: 15px;
display: block;
width: 500px;
height: auto;
background: #CCFFFF;
position: relative;
}
.TL
{
margin: 0;
padding: 0;
width: 105px;
height: 105px;
background: transparent url(offerBox_tl.gif) top left no-repeat;
position: absolute;
top: 0; left: 0;
}
.BR
{
margin: 0;
padding: 0;
width: 105px;
height: 105px;
background: transparent url(offerBox_br.gif) bottom right no-repeat;
position: absolute;
bottom: 0; right: 0;
}
.offerBox p
{
margin: 0;
padding: 4px;
background-color: #ffdfdf;
border: 1px solid #ffb9b9;
color: inherit;
}
#myElement{right:0}
#myElement{left:expression(String(this.parentNode.offsetWidth-this.offsetWidth)+'px')}
Note how the argument to expression is any javascript that returns a string.
IE6 ignores the first line and other browsers ignore the second line. Warning: offsetWidth, offsetHeight, etc. are 'outside' dimensions (including borders) whereas CSS width, height, etc. are 'inside' dimensions (at the padding boundary), so you must adjust your expressions appropriately.