2017-05-08 130 views
1

我试图创建一个带有标志的导航栏。我有导航栏基本上工作,但页面内容的标题也被迫进入导航栏。 enter image description here导航栏干扰标题HTML/CSS

这是我的HTML和我的网站的链接完整的源和观看(http://frankkreutzer.com/

 <header class="section"> 
     <a id="logo" href="http://frankkreutzer.com"><img src="images/logo.png" width="75" height="75"></a> 
     <nav> 
      <ul> 
       <li><a href="http://frankkreutzer.com" id="current">Home</a></li> 
       <li><a href="http://frankkreutzer.com/it-130/assignment-3/assignment3.html" target="_blank">IT 130</a></li> 
       <li><a href="http://frankkreutzer.com/csgo/csgo-home.html" target="_blank">CS:GO Project</a></li> 
       <li><a href="http://frankkreutzer.com/cth-247/index.html" target="_blank">CTH Final Project</a></li> 
       <li><a href="http://frankkreutzer.com/contact.html">Contact Me</a></li> 
      </ul> 
     </nav> 
    </header> 

下面是一些我的CSS:

header { 
top: 0; 
right: 0; 
left: 0; 
border-bottom: 1px solid #e3e3e8; 
} 

#logo { 
    float: left; 
    font-size: 3em; 
    margin: 0; 
    padding: .4em; 
    text-decoration: none; 
    color: #222222; 
    transition: .5s all; 
} 

nav { 
    float: right; 
} 

nav ul { 
    margin: 0; 
    padding: 2.8em 2em; 
} 

nav ul li { 
    display: inline; 
    padding: 0 .4em; 
} 

nav ul li a { 
    color: #222222; 
    text-decoration: none; 
    font-size: 20px; 
    padding-bottom: .5em; 
    transition: .5s color; 
} 

nav ul li a:hover { 
    border-bottom: 3px solid #222222; 
} 

#current { 
    color: #ff4629; 
    border-bottom: 3px solid #222222; 
} 
+2

'。内容为:{clear:既;}' - 更这里:https://css-tricks.com/all-about-floats/#article-header-id-2 – sol

+1

因为你正在使用在div上浮动属性。您可以使用.content {clear:both}或header {width:100%; float:left;} –

+0

@ovokuro uhhh,这是什么工作? – Frank

回答

1

添加overflow属性的头。

header{overflow: hidden;}