调整导航栏文本 - CSS

时间:2015-02-26 16:50:02

标签: html css

我遇到了这个当前的问题,我有点困惑。我将不胜感激。

我当前的导航栏如下所示:

我希望它是这样的:

以下是相关的CSS代码:

nav ul {
    list-style: none;
    margin: 0 auto;
    padding: 20px 0 0 0;
    border-top: 1px solid #333;
    width: 100% auto;
}
nav li {
    list-style-type: none;
    display: inline;
    ;
}
.first {
    display:inline;
    margin: 0 auto;
    padding: 0 auto;
}
@font-face {
    font-family:"Steelfish Rg";
    src: url(../fonts/steelfish_rg.ttf) format('truetype');
}
nav a {
    text-transform: uppercase;
    padding: 0 10px;
    font-family: Steelfish Rg, Helvetica, "Helvetica Neue", Arial, sans-serif;
    font-size: 50px;
    line-height: 51px;
    height: 78px auto;
    color: white;
    text-decoration: none;
    color: #ffffff;
    border-right: 1px solid #333;
    border-height: 20px;
    position: relative;
    width: 100% auto;
}
@font-face {
    font-family:"Clarendon Lt BT";
    src: url(../fonts/20924071.ttf) format('truetype');
}
nav small {
    font-family: Clarendon Lt BT;
    font-size: 13px;
    line-height: 17px;
    color: #ababaa;
    text align: left;
    font-weight: 700;
}
nav .bottom {
    margin-top:0;
    margin-bottom: -11px;
    text-align: right;
    padding: 0px 5px 0px 10px;
    position: absolute;
    bottom: 0;
    right: 19px;
}

以及导航的html的一部分:

<nav class="navigation">
    <ul>
        <li> 
            <a href="/eng/" class="first current">
                <small> get </small>
                <span> home </span>
                <small class="bottom">dude</small>
            </a>
        </li>
    </ul>
</nav>

Fiddle

我很感激帮助,谢谢!

2 个答案:

答案 0 :(得分:1)

父容器看起来并不是很清楚,但使用浮动和清除可以让你关闭。例如:

nav .first .bottom {
    text-align: right;
    float: right;
    clear: both;
}

<强> Demo

答案 1 :(得分:0)

目前,所有元素都是内联元素。你必须让它们阻止元素将每个单词分成一个新行。

  .first small {
     display: block;
  }
相关问题