0

现在正在显示什么。

我希望导航栏中的文本更接近白条的中心,并且菜单图标与单词 "Menu" 对齐。

任何指导表示赞赏。

HTML 代码:

<!doctype html>

<html>
    <head>
        <meta charset="UTF-8"/>
        <title> Foodstant Delivery </title>
        <link rel="stylesheet" type="text/css" media="screen" href="stylo.css" />
        <link rel="shortcut icon" href="images/favicon.ico" />
    </head>

<body>
    <div id="container">
        <figure id="logo"> 
            <img src="images/logo22.png" alt="Foodstant Delivery logo" width="" height="" />
        </figure>   

        <figure id="abtex">
            <img src="images/abtex222.png" />
        </figure>   

<div id="navbar">
    <ul>
        <li class="OP"><img src="images/order.png" /><a  href="Orders.html">Orders</a></li>
        <li class="MP"><img src="images/menupic3.png" /><a  href="Menu.html">Menu</a></li>
        <li class="CUP"><img src="images/contact.png" /><a href="ContactUs.html">Contact</a></li>
        <li class="TCP"><img src="images/Pen.png" /><a href="Jobs.html" target="_blank">About</a></li>
        <li class="JP"><img src="images/pin.png" /><a  href="TC.html">Jobs</a></li>
    </ul>   
</div>

</div>

</body> 

</html> 

CSS 代码:(相关)

#navbar {
    background: rgb(246,248,249); /* Old browsers */
    background: -moz-linear-gradient(top,  rgba(246,248,249,1) 0%, rgba(229,235,238,1) 46%, rgba(215,222,227,1) 65%, rgba(245,247,249,1) 100%); /* FF3.6+ */
    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(246,248,249,1)), color-stop(46%,rgba(229,235,238,1)), color-stop(65%,rgba(215,222,227,1)), color-stop(100%,rgba(245,247,249,1))); /* Chrome,Safari4+ */
    background: -webkit-linear-gradient(top,  rgba(246,248,249,1) 0%,rgba(229,235,238,1) 46%,rgba(215,222,227,1) 65%,rgba(245,247,249,1) 100%); /* Chrome10+,Safari5.1+ */
    background: -o-linear-gradient(top,  rgba(246,248,249,1) 0%,rgba(229,235,238,1) 46%,rgba(215,222,227,1) 65%,rgba(245,247,249,1) 100%); /* Opera 11.10+ */
    background: -ms-linear-gradient(top,  rgba(246,248,249,1) 0%,rgba(229,235,238,1) 46%,rgba(215,222,227,1) 65%,rgba(245,247,249,1) 100%); /* IE10+ */
    background: linear-gradient(to bottom,  rgba(246,248,249,1) 0%,rgba(229,235,238,1) 46%,rgba(215,222,227,1) 65%,rgba(245,247,249,1) 100%); /* W3C */
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f6f8f9', endColorstr='#f5f7f9',GradientType=0 ); /* IE6-9 */

    border-top-left-radius: 10px;
    border-bottom-left-radius:10px;
    border-top-right-radius: 10px; 
    border-bottom-right-radius:10px;

    position: absolute;
    top: 200px;
    left: 150px;
    width: 1000px;

    background-position:center;

    font-size: 26px;
    font-family: 'Conv_LITHOSPRO-REGULAR';

    box-shadow: 3px 5px 10px  #888888;      
}
#navbar ul {
    list-style-position:inside;
    padding-top: 10px;
}


#navbar ul li {     
        display: inline;
        padding:0 60px 0px 0px; 
        margin-bottom: 10px;
        list-style-type:disc;
    }


#navbar ul li.OP {
        padding-left: 40px;
}   

a:link {
  color: #EF174A;
  }

a:visited {
  color: #BF4100;
  }

a:hover {
  color: black;
  background-color:#D2D2D2;
  border-radius: 10px;
  }

a:active {
  color: #918FBC;
  } 

a {
    text-decoration:none;
}  

#navbar ul li.OP a {
    padding-left: 10px;
}
4

2 回答 2

0
<img src="" align="absmiddle">

这将使文本与图像的中间对齐。

或者你可以用 css 来做:

.your_class {
    vertical-align:middle;
} 
于 2012-07-22T09:02:59.777 回答
0

使文本行高等于条的高度。

a.yourtext { line-height: 44px }

但要注意填充物。

于 2012-07-22T09:35:40.790 回答