Forum Moderators: not2easy

Message Too Old, No Replies

NavMenu Line-height compativility?

line-height : irregular on IE6Win

         

batata

4:14 am on Apr 25, 2004 (gmt 0)

10+ Year Member



Hi everyone.

I have a navigation menu with links on the left side of my site, but on IE on Win, it looks like the line-height is changing every 2 links, other words: it has irregular line spacing.
If I use:
display:block; it seems to correct it but it creates a "block" when I click on that link, and that's what i want to avoid and I tried display:list-item, wich fix it but creates numbers on IE Mac! I used line-height but nothing happened.

here is the CSS:

.navActive {
font-size:11.5px;
font-family:arial,helvetica,geneva,sans-serif;
font-weight:bold;
width:60px;
text-decoration:none;
color:#006699;
}

.nav {
font-size:11.5px;
font-family:arial,helvetica,geneva,sans-serif;
width: 60px
text-decoration:none;
color:#006699;
}

Here is the HTML for that layer:

<div id="Layer2" style="position:absolute; left:65px; top:124px; width:60px; height:143px; z-index:2">
<a href="/index.html" class="nav">Home</a>
<a href="/contactform.html" class="navActive">Contact</a> <a href="/gallery.html" class="nav">Gallery</a>
<a href="/cookbook.html" class="nav">Cookbook</a> <a href="/city_tour.html" class="nav">City
Tour</a> <a href="/portfolio.html" class="nav">Portfolio</a> <a href="/resume.html" class="nav">Resume</a></div>

Thanks!
I'm using Dreamweaver on a Mac OS9.2, IE5.2

Bonusbana

2:31 pm on Apr 25, 2004 (gmt 0)

10+ Year Member



Use a list:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=ISO-8859-1">
<title>yo</title>
<style type="text/css">

.list {
width: 60px;
list-style: none;
padding: 0;
margin: 0;
}

.list a {
font: 11.5px arial,helvetica,geneva,sans-serif;
text-decoration: none;
color: #069;
}

.list li.active a {font-weight: bold;}

</style>
</head>
<body>
<div id="Layer2" style="position:absolute; left:65px; top:124px; width:60px; height:143px; z-index:2">
<ul class="list">
<li><a href="/index.html">Home</a></li>
<li class="active"><a href="/contactform.html">Contact</a></li>
<li><a href="/gallery.html">Gallery</a></li>
<li><a href="/cookbook.html">Cookbook</a></li>
<li><a href="/city_tour.html">City Tour</a></li>
<li><a href="/portfolio.html">Portfolio</a></li>
<li><a href="/resume.html">Resume</a></li>
</ul>
</div>
</body>
</html>

batata

6:27 pm on Apr 25, 2004 (gmt 0)

10+ Year Member



Thanks,
it fixes on IE Win, but it creates a "block" around the link text on IE Macintosh.

Seems like when I take out the 'block' from Mac, it shows up on Win, and viceversa.

Still testing.... because I want them to look even, and without any 'block' around when i select them.

any idea? thanks in advance!

Bonusbana

8:32 pm on Apr 25, 2004 (gmt 0)

10+ Year Member



There is no block in the CSS, what you might encounter is the grey border that IE5/mac has implemented in their interface when you click on a link. It occurs around any link and there is no way CSS can get rid of it.

However, there is a clever javascript that does the trick:

// REMOVES THE LINK BORDER IN IE4+, NS6
// Works: IE4+, NS6+
// Notes: In NS6 the select tags are not blurred

function unblur() {
this.blur();
}

function getLinksToBlur() {
links = document.getElementsByTagName("a");
for(i=0; i<links.length; i++) {
links[i].onfocus = unblur
}
}

Then just add onload="getLinksToBlur();" in your body tag.

batata

11:05 pm on Apr 25, 2004 (gmt 0)

10+ Year Member



THANK YOU!
It solved the borders around the links on MAC!

Still I wonder one thing:
Why on my home page, without any javascript at all, i don't have any border at all on any link, on a mac of course and on windows too. That's why I thought it was a Css problem, not IE issue.

Thanks for your time!
:)

Bonusbana

9:16 am on Apr 26, 2004 (gmt 0)

10+ Year Member



Sounds interesting, sticky me with your url and Ill have a look.

Bonusbana

9:32 am on Apr 26, 2004 (gmt 0)

10+ Year Member



Actually, there is a way to remove the link borders in CSS. I did some digging and found the outline [w3.org] property. It is not widely supported, but IE5/mac recognizes it. So, just add a

a {outline: none;}

in your css and remove the javascript I posted earlier. Of course, this also lets you style the border in any way you like.

batata

3:36 pm on Apr 26, 2004 (gmt 0)

10+ Year Member



Yes,
the outline is taking out the borders around the links.
But , there is always a but... ;(
I needed to fix 2 things:
irregular line-height on Windows
border around links on Macintosh, then:

The list property helped to correct the line-height (it was irregular "jumpy" on Windows).

The Javascript helped to "not show" those borders around the links.

Somewhow, if I take out only the Javascript, and insert the outline as replacement, that creates Bullets for the 'list property'.

If I go back to the original code, (no java, no list property), and Add only the outline property, I fix only the borders around links, but shows irregular line-height on Windows.

Well, is working perfect with the first things you said, but I will try with the outline and more combinations. I'll keep you posted.
:) Thanks again!