无法在nav标签中给出宽度和高度

时间:2014-09-02 10:47:43

标签: html css

我正在尝试像这样导航: enter image description here

我用nav标签开始这个,但当我给它的宽度和高度时,它看起来像这样: enter image description here

#auzi{
  margin-left:55px;
  width:90px;
  height:35px;
  color:#246c41;
  background: url(https://fbcdn-sphotos-d-a.akamaihd.net/hphotos-ak-xap1/v/t1.0-9/13646_802426683122032_8872692336592806117_n.jpg?oh=d9ebec474b44c2172aff91a26cbe8745&oe=5480A9F5&__gda__=1416669080_db2840f489895af5e3e8515bdc781921) no-repeat;
  text-align:center;
}

我做错了什么?

JSFIDDLE

3 个答案:

答案 0 :(得分:3)

由于<a>是内嵌元素,因此不接受任何heightwidth,只需将display:block; display: inline-block #auzi添加到您的{{1}} }

<强> DEMO

答案 1 :(得分:0)

尝试添加:

display:inline-block

到#auzi css。

答案 2 :(得分:0)

让你的外部div显示:table-cell,或者给它一个适当大小的行高。

#choose{
    width:675px;
    height:50px;
    display: table-cell;
    line-height: 85px;
}

DEMO