2016-04-14 9 views
-1

nav_top divの完全な高さを占める3つのクリック可能な領域を持つメニューを作成しようとしています。ブラウザのサイズを変更するとそのように縮小されます。各LIには左のアイコンと異なる色の背景があります。あなたが何かを修正した場合、何か他のものが壊れてしまうという問題があります。 私は各cantは正しく動作するようにnavメニューを取得します

li a { 
height:100%; 
width :30%: 
background-color: red; 
} 

何もそれは各リチウム30%の幅を作るのと同じくらい簡単であるべき

image of what im trying to do を起こらないようにしよう場合、私は、Liは、右の最初のLiは第三
になっ浮く場合背景色を追加し、画像を左にパディングします。

<!DOCTYPE html> 
<style> 
/* CSS Document */ 
html,body{ 
padding:0px; 
margin:0px; 
height:100%; 
width:100%; 
background-color:#f0f0f0; 
} 
/* MOBILE BROWSER THING*/ 
.menu{ 
width:60%; 
border: 1px solid blue; 
}  
a.menu-link { 
display:none; 
} 
/* MOBILE BROWSER THING*/ 
header{ 
width:100%; 
display:table; 
border: 1px solid red; 
background-color:#f0f0f0; 
} 
#logohold{ 
width:19%; 
background-color:#0FF; 
height:125px; 
float:left; 
} 
#navhold{ 
width:79%; 
    background-color:#3F0; 
    height:125px; 
border: 1px solid purple; 
    float:right; 
    } 

#nav_top{ 
border: 1px solid green; 
background-color:#f0f0f0; 
width:100%; 
height:49%; 
} 
#nav_bot{ 
border: 1px solid green; 
background-color:#f0f0f0; 
width:100%; 
height:49%; 
} 
#float_right{ 
float:right;width:79%;} 
#tpmenu{ 
float:right; 
background-color:#F0F;/* visulize nav*/ 
width:100%; 
height:100%; 
text-transform: uppercase; 
list-style-type: none; 
margin: 0; 
padding: 0; 
overflow: hidden; 
} 
#tpmenu li {margin: 0; 
padding: 0; 
border: 1px solid blue;/* visulize each li*/ 
display:inline;/* left to right li*/ 

} 
#tpmenu li a{margin: 0; 
padding: 0; 
padding-top:20px; 
padding-bottom:20px; 
text-decoration:none; 
    text-align: center; 
font-size:15px; 
height:100%;/* take up the full width of the ul div*/ 
border: px solid green;/* visulize each li*/ 
display:inline-block;/* left to right li*/ 
width:30%;/* each li is 30% width*/ 

} 
#tpmenu li.top_app a { 
color:#FFF; 
background:url('http://www.cheesetoast.co.uk/cheesepress/wp-content/uploads/2012/08/home.gif') no-repeat no-repeat ; 
background-position:center; 
background-position:left; background-color:#000000; 

} 
#tpmenu li.top_quote a { 
color:#FFF; 
background:url('http://www.cheesetoast.co.uk/cheesepress/wp-content/uploads/2012/08/home.gif') no-repeat no-repeat ; 
background-position:center; 
background-position:left; 
background-color:#F00; 

} 
#tpmenu li.top_repair a { 
color:#000; 
background:url('http://www.cheesetoast.co.uk/cheesepress/wp-content/uploads/2012/08/home.gif') no-repeat no-repeat ; 
background-position:center; 
background-position:left; 
background-color:#f0f0f0; 

} 



*/ 





/*  telephone number  */ 
#top_menu_phone{ 
float:right; 
} 
#top_menu_phone a{ 
} 
span.tele{ 
height:15px; 
width:15px; 
background:url('http://www.cheesetoast.co.uk/cheesepress/wp-content/uploads /2012/08/home.gif') no-repeat no-repeat ; 
background-position:center; 
background-position:left; 
} 


#mobmenu_hidden{ 
display:none;/* hides the mobile menu button on destop*/ 
height:100%; 
width:15%; 
background-color:#0FF; 

} 








</style> 


<header> 

<div id="logohold">logo</div><!--logohold--> 

<div id="navhold"> 
<div id="nav_top"> 
<div id="mobmenu_hidden">hidden menu</div><!--mobmenu_hidden--> 
<div id="float_right"> 
<ul id="tpmenu"> 
<li class="top_repair"><a href="repair status">repair status</a></li> 
<li class="top_app"><a href="set up appointment">set up appointment</a>  </li> 
<li class="top_quote"><a href="get a quote">get a quote</a></li> 
</ul> 
</div><!--float_right--> 

</div><!--nav_top--> 





<div id="nav_bot">nav_bottom 
<!--top_menu_phone--> 
<div id="top_menu_phone"><a href="tel:16142585555"><span class="tele">&nbsp;& nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span> (614)258-5555</a> </div> 
<!--top_menu_phone--> 
</div><!--nav_bot--> 


</div><!--navhold--> 
</header><!--header--> 
+0

捜しているものであると思います

それだと思いますgivマージンまたはhtmlへのパディング – DanyCode

答えて

0

はごめんなさいしかし、あなたのコードはすごいそれがで

ビット不明であった 私を怒らせるために 右navholderの70%の幅でのULフロートを持つことが、何も作業していないし、その開始されますこのexemple私は、フレットボックスを働いた私はそれがあなたが欲しいものであるかどうかわからないが、あなたが私に5minを与える場合のように私を探します私は何をし、理由を説明します!

私はいつも "親"にしましたdisplay:flex;私はnavの横にロゴを置いています!

と私は右側に私がやったdisplay:flex; divwhereをgived右

のみ2divロゴが左親とNAVに肝炎するdivの右側にすべてをかけるが、今回flex-direction:column;へマージンはデフォルトで、左側にありますので、私はmargin:16px;のかかりましたので、あなたは70%たかった下

トップの下にトップを置くデフォルト

によってpadding:40pxは今トップにあなたの李さんを入れて、あなたが与えるされますそれらheight:100%; and width:30%; は、あなたの背景とあなた<a>

を置くリーに私はそれは私が持っているあなたはいけない、それはあなたが

.test{ 
 
    height:125px; 
 
    width:90%; 
 
    margin:auto; 
 
    background-color:pink; 
 
    display:flex; 
 
    justify-content:space-between; 
 
} 
 
.logo{ 
 
    background-color:red; 
 
    width:19%; 
 
    height:100%; 
 
} 
 
.right{ 
 
    width:100%; 
 
    height:125px; 
 
    background-color:blue; 
 
    display:flex; 
 
    flex-direction:column; 
 
    align-items:flex-end; 
 
    justify-content:center; 
 
} 
 
.top{ 
 
    margin:0px; 
 
    padding-left:0px; 
 
    width:70%; 
 
height:50%; 
 
    display:flex; 
 
    justify-content:flex-end; 
 
    background-color:cyan; 
 
    list-style:none; 
 
} 
 
.one{ 
 
    width:30%; 
 
height:100%; 
 
    background-color:pink; 
 
    display:flex; 
 
    align-items:center; 
 
    justify-content:space-around; 
 
} 
 
.phone{ 
 
    height:15px; 
 
width:15px; 
 
    background:white; 
 
} 
 
.two{ 
 
    width:30%; 
 
height:100%; 
 
    background-color:brown; 
 
} 
 
.tree{ 
 
    width:30%; 
 
height:100%; 
 
    background-color:gold; 
 
} 
 
.green{ 
 
    height:50%; 
 
    width:100%; 
 
    background-color:green; 
 
}
<div class="test"> 
 
    <div class="logo"> 
 
    <h1>logo</h1> 
 
    </div> 
 
    <div class="right"> 
 
    
 

 
    <ul class="top"> 
 
    <li class="one"> 
 
    <div class="phone"> 
 
    </div> 
 
LI One 
 
    </li> 
 
    <li class="two"> 
 
    two 
 
    </li> 
 
    <li class="tree"> 
 
    tree 
 
    </li> 
 
    </ul> 
 
    <div class="green"> 
 
    bottom 
 
    </div> 
 
</div> 
 
</div>

関連する問題