jkiv
26th June 07, 05:44 AM
I ... wish to love CSS if it wasn't for IE. I made an awesome layout in Firefox but fails in IE. I've messed with it down to one last problem: the length of a piece of text in a <span> overrides both the width of the parent <a> and the <span>.
I have an <a> that is 40x40. Inside that is a <span> that is inside the <a> (i've tried floating it and relative position... same diff). Inside that I have text. It wraps if its more than one word, so I use instead of regular space. In firefox the text extends beyond the limits of the <a> but in IE it re-sizes the <a>.
If anyone has a better idea to have text to appear above a 40x40 link square link (i've tried float and margin-top: -1.1em... and decided to go position: relative; top: -1.1em) so the text looks right-justified (ends at the right side of the square link box)
Thanks (first time posting)
P.S.
HTML
<div class="nav">
<img src="menu_logo.jpg" style="float: left" />
<a class="a" href="#"><span class="label">Ruby Moon</span></a>
<!-- removed some links -->
<a class="b" href="#"><span class="label">Contact</span></a>
</div>
.label{
position: relative;
top: -1.2em;
text-align: right;
font-size: 1.1em;
height: 1.1em;
line-height: 1.1em;
color: #0f0;
visibility: hidden;
display: none;
width: 40px;
}
.a, .b, .c, .d {
float: right;
display: block;
height: 40px;
width: 40px;
}
.a:hover, .b:hover, .c:hover, .d:hover {
background: #000;
}
.a:hover span, .b:hover span, .c:hover span, .d:hover span{
color: #000;
margin-left: 0;
visibility: visible;
display: inline;
width: 40px;
}
I have an <a> that is 40x40. Inside that is a <span> that is inside the <a> (i've tried floating it and relative position... same diff). Inside that I have text. It wraps if its more than one word, so I use instead of regular space. In firefox the text extends beyond the limits of the <a> but in IE it re-sizes the <a>.
If anyone has a better idea to have text to appear above a 40x40 link square link (i've tried float and margin-top: -1.1em... and decided to go position: relative; top: -1.1em) so the text looks right-justified (ends at the right side of the square link box)
Thanks (first time posting)
P.S.
HTML
<div class="nav">
<img src="menu_logo.jpg" style="float: left" />
<a class="a" href="#"><span class="label">Ruby Moon</span></a>
<!-- removed some links -->
<a class="b" href="#"><span class="label">Contact</span></a>
</div>
.label{
position: relative;
top: -1.2em;
text-align: right;
font-size: 1.1em;
height: 1.1em;
line-height: 1.1em;
color: #0f0;
visibility: hidden;
display: none;
width: 40px;
}
.a, .b, .c, .d {
float: right;
display: block;
height: 40px;
width: 40px;
}
.a:hover, .b:hover, .c:hover, .d:hover {
background: #000;
}
.a:hover span, .b:hover span, .c:hover span, .d:hover span{
color: #000;
margin-left: 0;
visibility: visible;
display: inline;
width: 40px;
}