2012-01-29 4 views
0

に表示されていません。 また、問題の幅はです。高さはフォントの高さと同じですから、35pxの高さはmargin leftで、right5pxに設定してください。リストのスタイルのメニューは、ここでは、コードを見ることができますライン

問題はどこですか?

+3

あなたはディスプレイの代わりにディプレイを書く!! – Hadas

+0

ああ、本当の ';'私の悪いですが、行の画像の高さの問題はどうですか? – Cyclone

答えて

3

あなたのスタイルシートを更新する必要があります。この新しいスタイルを追加してください:

#menu { 
    position: relative; 
    clear: both; 
    top: -3px; 
    background-color: coral; 
    border: 1px solid black; 
    width: 800px; 
    height: 35px; 
    float:left; 
} 

li { display: inline;float:left; } 

#menu ul { 
    position: absolute; 
    font-family: Century Gothic, sans-serif; 
    font-size: 14px; 
    list-style-type: none; 
    padding: 0; 
    margin: 9px 0 0 123px; 
    width: 649px; 
    height: 39px; 
    color: #FFF; 
    float:left; 
} 

a { font-weight: bold; color: red; text-decoration: none; } 
a:hover { text-decoration: underline; } 

#menu a { 
background: url('http://i.imgur.com/rzNj0.png') top right no-repeat; 
width: 65px; 
height: 18px; 
float: left; 
margin: 0px 5px; 
} 

float:leftを追加する必要があります。メニューdiv、ul、li、aにまた、タグの幅と高さと余白を設定する必要があります。 http://jsfiddle.net/YjeBs/

・ホープ、このことができます:)

EDIT:

あなたの行は、メニューのdivの上から下に拡張したい場合は、変更することができますがここで

はワーキングサンプルがありますあなたのスタイルに:

#menu { 
    position: relative; 
    clear: both; 
    top: -3px; 
    background-color: coral; 
    border: 1px solid black; 
    width: 800px; 
    height: 35px; 
    float:left; 
} 

li { 
float: left; 
    height: 35px; 
    display:inline; 
} 

#menu ul { 
color: #FFFFFF; 
    float: left; 
    font-family: Century Gothic,sans-serif; 
    font-size: 14px; 
    height: 35px; 
    list-style-type: none; 
    margin: 0 0 0 123px; 
    padding: 0; 
    position: absolute; 
    width: 649px; 
} 

a { font-weight: bold; color: red; text-decoration: none; } 
a:hover { text-decoration: underline; } 

#menu a { 
background: url("http://i.imgur.com/rzNj0.png") no-repeat scroll right top transparent; 
    float: left; 
    height: 29px; 
    margin: 0 5px; 
    padding-top: 8px; 
    width: 65px; 
} 

希望、これはあなたが:)

0123をしたいです
+0

これはうまくいきますが、 'line'画像(' #menu a')の高さはまだ '35px'('#menu'高と同じ高さ)に設定することはできません。 。 – Cyclone

+0

なぜ、ラインイメージの背景の高さをメニューの高さに設定する必要がありますか? – Sabari

+0

35px、 '#menu'バーと同じです。 – Cyclone

0

ちょうどli { diplay: inline; }と変更すると、li { display: inline; }となります。

関連する問題