---
title: "Behöver hjälp med css-meny"
type: "forum-thread"
url: "https://www.webforum.nu/amne/html-css/164617-behöver-hjälp-med-css-meny"
topic: "HTML & CSS"
topic_url: "https://www.webforum.nu/amne/html-css"
author: "silfver"
published: "2007-09-18T10:19:20.000Z"
updated: "2007-09-19T09:03:04.000Z"
replies: 8
views: 639
page: 1
pages: 1
language: "sv-SE"
site: "webForum — webforum.nu"
rights: "Upphovsrätten till varje inlägg tillhör dess författare."
attribution: "Citera som: webForum, https://www.webforum.nu/amne/html-css/164617-behöver-hjälp-med-css-meny"
---

# Behöver hjälp med css-meny

## #1 — silfver, 2007-09-18T10:19Z

Jag behöver experthjälp med en css-meny jag håller på med. Menyn måste se likadan ut i både Firefox och Internet Explorer - är det möjligt?

Sidan hittar ni här (och det ser bra ut i Firefox men inte i IE):
<http://silfver.se/temp/css-meny/>

Och bilderna finns här:
<http://silfver.se/temp/css-meny/header-bg.png>
<http://silfver.se/temp/css-meny/menu-hover.png>

Jag vill att det ska se ut som i den bifogade filen men jag lyckas fan inte alltså! Inte i båda samtidigt i alla fall.

Nuvarande css: 

```
body {margin: 0; padding: 0; background: url(header-bg.png) repeat-x; font-family: verdana;}

#menu ul {border-left: 1px solid #5c89a9;}
#menu ul li {display: inline; float: left; line-height: 162px; font-size: .7em;}
#menu a {text-decoration: none; padding: 90px 10px 8px 10px; color: #fff; border-right: 1px solid #5c89a9;}
	#menu a:hover {background: url(menu-hover.png);}
```

Hjälp? :birp

Bilagor:

- [meny.png](https://www.webforum.nu/a/15937.png)

Permalänk: https://www.webforum.nu/p/164617

## #2 — dea, 2007-09-18T10:51Z

prova detta, ett ie-hack, ska fungera i ie6

```
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="sv">
<head>
	<title>PF Concept</title>
	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
	<style type="text/css">
	body {margin: 0; padding: 0; background: url(header-bg.png) repeat-x; font-family: verdana;}

	#menu ul {border-left: 1px solid #5c89a9;}
	#menu ul li {display: inline; float: left; line-height: 162px; font-size: .7em;}
	[B]* html ul li { padding-top:15px; }[/B]
	#menu a {text-decoration: none; padding: 90px 10px 8px 10px; color: #fff; border-right: 1px solid #5c89a9;}
		#menu a:hover {background: url(menu-hover.png);}
	
	#menu a#active {background: url(menu-hover.png);}
	</style>
</head>

<body>
<div id="menu">
    <ul>
    	<li><a href="#" id="active">startsida</a></li>
    	<li><a href="#">produkter</a></li>
    	<li><a href="#">information</a></li>
    </ul>
</div>

</body>
</html>
```

Permalänk: https://www.webforum.nu/p/2029332

## #3 — silfver, 2007-09-18T10:59Z

Fungerar inte i IE7. :l

Permalänk: https://www.webforum.nu/p/2029336

## #4 — dea, 2007-09-18T11:05Z

prova

```
}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="sv">
<head>
	<title>PF Concept</title>
	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
	<style type="text/css">
	body {margin: 0; padding: 0; background: url(header-bg.png) repeat-x; font-family: verdana;}

	#menu ul {border-left: 1px solid #5c89a9;}
	#menu ul li {display: inline; float: left; line-height: 162px; font-size: .7em;}
	[B]*:first-child+html ul li { padding-top:15px; }
	* html ul li { padding-top:15px; }[/B]
	#menu a {text-decoration: none; padding: 90px 10px 8px 10px; color: #fff; border-right: 1px solid #5c89a9;}
		#menu a:hover {background: url(menu-hover.png);}
	
	#menu a#active {background: url(menu-hover.png);}
	</style>
</head>

<body>
<div id="menu">
    <ul>
    	<li><a href="#" id="active">startsida</a></li>
    	<li><a href="#">produkter</a></li>
    	<li><a href="#">information</a></li>
    </ul>
</div>

</body>
</html>
	
}
```

\*:first-child+ är ett ie7 hack som jag tror inte läses av ff

Permalänk: https://www.webforum.nu/p/2029338

## #5 — colione, 2007-09-18T11:11Z

Lägg det hela i en Conditional Comment?

```
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="sv">
<head>
	<title>PF Concept</title>
	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
	<style type="text/css">
	body {margin: 0; padding: 0; background:pink; font-family: verdana;}

	#menu ul {border-left: 1px solid #5c89a9;}
	#menu ul li {display: inline; float: left; line-height: 162px; font-size: .7em;}

	#menu a {text-decoration: none; padding: 90px 10px 8px 10px; color: #fff; border-right: 1px solid #5c89a9;}
		#menu a:hover {background: yellow;}
	
	#menu a#active {background:yellow;}
	</style>
<!--[if IE]>
<style type="text/css">
#menu ul li { padding-top:15px; }
</style>

<![endif]-->
</head>

<body>
<div id="menu">
    <ul>
    	<li><a href="#" id="active">startsida</a></li>
    	<li><a href="#">produkter</a></li>
    	<li><a href="#">information</a></li>
    </ul>
</div>

</body>
</html>
```

Permalänk: https://www.webforum.nu/p/2029341

## #6 — silfver, 2007-09-18T12:11Z

Kungligt, dea! Tack för hjälpen. :bire

Permalänk: https://www.webforum.nu/p/2029364

## #7 — colione, 2007-09-18T12:43Z

Varför välja css-hack framför en contidional comment? När nästa version av ie kommer och den inte tolkar hacket längre, måste du komma upp med ett nytt hack men med conditional commenten behöver du max lägga till 4 tecken.

Permalänk: https://www.webforum.nu/p/2029376

## #8 — frippz, 2007-09-19T07:56Z

colione har rätt. Lägg alla IE-hacks i *en* ie.css som importeras via CC och filtrera ut hack som riktar sig mot IE6 med \* html inuti ie.css. Håll det enkelt. ;)

Permalänk: https://www.webforum.nu/p/2029678

## #9 — colione, 2007-09-19T09:03Z

Eller så använder du fler conditional comments och en css-fil för ie6 och en för ie7. ;) Annars kan du få liknande problem igen senare.

Permalänk: https://www.webforum.nu/p/2029690

---

Tråden på webben: https://www.webforum.nu/amne/html-css/164617-behöver-hjälp-med-css-meny
