2016-09-09 39 views
0

現在我知道這可能是超級簡單,容易和明顯,但我已經敲了我的腦袋兩天試圖找出結果。 Google風起雲涌。在引導中對齊兩行內的列表

我想對齊頁面底部的兩個列表中的鏈接來製作導航欄。我使用bootstrap和字體真棒圖標。看起來好像字體真棒圖標比我使用的字體更大,導致錯位。

你可以在這裏看到我的問題通過codepen(其最顯着的以全屏模式或通過移動設備):

<http://codepen.io/alexwilson/pen/mAJqWX?editors=1100> 

這裏的HTML:

<head> 
    <link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> 
    <link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.no-icons.min.css" rel="stylesheet"> 
    <link href="//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css" rel="stylesheet"> 
    <link rel="stylesheet" type="text/css" href="main.css"> 
    <script src="https://use.fontawesome.com/383177a704.js"></script> 
    <title>Alex Wilson - Man, Web Designer, Legend</title> 
</head> 
<body> 
    <div class="container-fluid"> 
     <div class="row headline"> 
     </div> 

      <div class="row"> 
        <ul id="list-left"> 
         <li><a href="Home.html">Home</a></li> 
         <li><a href="About.html">About</a></li> 
      <li><a href="work.html">Work</a></li> 
      </ul> 
         <ul id="list-right"> 
          <li><a href="https://www.linkedin.com/in/alexwilson33"><i class="fa fa-linkedin" aria-hidden="true"></i></a></li> 
          <li><a href="https://github.com/AWilso30"><i class="fa fa-github" aria-hidden="true"></i></a></li> 
          <li><a href="https://twitter.com/XZISTTT"><i class="fa fa-twitter" aria-hidden="true"></i></a></li> 
          <li><a href="https://www.facebook.com/djcastaway"><i class="fa fa-facebook" aria-hidden="true"></i></a></li> 
          <li><a href="email.com"><i class="fa fa-envelope" aria-hidden="true"></i></a></li> 
         </ul> 
        </div> 
       </div> 
      </div> 
     </div> 
    </body> 
    </html> 

CSS:

body, 
html, 
.container-fluid { 
    height: 100%; 
    width: 100%; 
    margin: 0px !important; 
    padding: 0px !important; 
} 

.headline { 
    height: 94%; 
    background: url(http://www.desktopimages.org/pictures/2014/1025/1/orig_58711.jpg) no-repeat center center fixed; 
    -webkit-background-size: cover; 
    -moz-background-size: cover; 
    -o-background-size: cover; 
    background-size: cover; 
} 

.row { 
    margin-right: 0px !important; 
} 
.row a { 
    color: black; 
} 
.row a:link { 
    text-decoration: none; 
} 

.row a:visited { 
    text-decoration: none; 
} 

.row a:hover { 
    text-decoration: none; 
    color: gray; 
} 

.row a:active { 
    text-decoration: none; 
} 

.row ul { 
    text-align: center; 
    display: inline-block; 
} 

.row li { 
    display: inline-block; 
} 

#list-left { 
    font-size: 3vh; 
    display: inline-block; 
    width: 49%; 
    margin: 0; 
    padding: 0; 
} 
#list-right { 
    font-size: 3vh; 
    display: inline-block; 
    width: 49%; 
    margin: 0; 
    padding: 0; 
} 

在我試圖創建的底部導航欄中,它看起來像右側的圖標放置得比文字鏈接在左邊。

請記住,我希望一切都是響應這就是爲什麼我已經設置字體大小爲vh。

有沒有人有一個想法,我可以如何使左側的鏈接與正確的圖標垂直對齊?

我試過設置字體大小爲圖標比左側的鏈接,我已經嘗試在bootstrap中創建兩列xs-6,我試着用填充和邊緣爲divs和ul的自己和更多。到目前爲止沒有任何工作正確。

在此先感謝您的幫助。

+0

你嘗試垂直對齊:頂部? – user1725382

+0

你應該在問題本身包含相關的代碼,提供一個codepen是好的,但不夠。 – vals

+0

好的。我已經包含了代碼。感謝您的提升。 –

回答

0

在這裏,你去。我扔了一些不必要的東西,希望這有助於。

/*<!-- 
 
nest all nav?? 
 
color nav and links 
 
make nav and links larger 
 
make bg image slightly smaller 
 
crop top of bg image to fit bottom 
 
add padding to bg image 
 
new font 
 
larger nav 
 
-->*/ 
 

 
body { 
 
    background: url(http://www.desktopimages.org/pictures/2014/1025/1/orig_58711.jpg) no-repeat center center fixed; 
 
    -webkit-background-size: cover; 
 
    -moz-background-size: cover; 
 
    -o-background-size: cover; 
 
    background-size: cover; 
 
} 
 
.row { 
 
    margin:0 !important; 
 
    position: fixed; 
 
    bottom: 0; 
 
    left: 0; 
 
    height: 6vh; 
 
    width: 100%; 
 
    background: white; 
 
} 
 
.row a { 
 
    color: black; 
 
} 
 
.row a:link { 
 
    text-decoration: none; 
 
} 
 
.row a:visited { 
 
    text-decoration: none; 
 
} 
 
.row a:hover { 
 
    text-decoration: none; 
 
    color: gray; 
 
} 
 
.row a:active { 
 
    text-decoration: none; 
 
} 
 
.row ul { 
 
    text-align: center; 
 
    display: inline-block; 
 
} 
 
.row li { 
 
    display: inline-block; 
 
} 
 
#list-left, 
 
#list-right { 
 
    font-size: 3vh; 
 
    line-height: 6vh; 
 
    display: inline-block; 
 
    width: 49%; 
 
    margin: 0; 
 
    padding: 0; 
 
}
<html> 
 

 
<head> 
 
    <link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> 
 
    <link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.no-icons.min.css" rel="stylesheet"> 
 
    <link href="//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css" rel="stylesheet"> 
 
    <link rel="stylesheet" type="text/css" href="main.css"> 
 
    <script src="https://use.fontawesome.com/383177a704.js"></script> 
 
    <title>Alex Wilson - Man, Web Designer, Legend</title> 
 
</head> 
 

 
<body> 
 
    <div class="row"> 
 
    <ul id="list-left"> 
 
     <li><a href="Home.html">Home</a> 
 
     </li> 
 
     <li><a href="About.html">About</a> 
 
     </li> 
 
     <li><a href="work.html">Work</a> 
 
     </li> 
 
    </ul> 
 
    <ul id="list-right"> 
 
     <li><a href="https://www.linkedin.com/in/alexwilson33"><i class="fa fa-linkedin" aria-hidden="true"></i></a> 
 
     </li> 
 
     <li><a href="https://github.com/AWilso30"><i class="fa fa-github" aria-hidden="true"></i></a> 
 
     </li> 
 
     <li><a href="https://twitter.com/XZISTTT"><i class="fa fa-twitter" aria-hidden="true"></i></a> 
 
     </li> 
 
     <li><a href="https://www.facebook.com/djcastaway"><i class="fa fa-facebook" aria-hidden="true"></i></a> 
 
     </li> 
 
     <li><a href="email.com"><i class="fa fa-envelope" aria-hidden="true"></i></a> 
 
     </li> 
 
    </ul> 
 
    </div> 
 
    </div> 
 
    </div> 
 
</body> 
 

 
</html>

+0

哇。看起來很完美。非常感謝!所以,糾正我,如果我錯了,但你只是刪除了容器流體和一些不必要的div。然後,修復您在字體大小和行高中彈出的大小差異,並將其放在列表的右側。那是對的嗎?我仍然不明白爲什麼它不工作,因爲我讀的大部分內容都告訴我要用引導程序將所有內容都包裝在容器中。你能否詳細說明爲什麼這個工作和以前的代碼沒有? –

+0

對於第一部分是字體大小和更大的行高自動居中。另外我檢查了你的版本,看起來你的酒吧並不在底部,現在它的位置是固定的,底部是0。 :) –

+0

我將不勝感激,如果你能標記我的答案幫助你:) –