li標簽行內元素高度及居中


 

 

<head>
<title><title>
<style type="text/css">
        *
        {
            padding: 0px;
            margin: 0px;
        }
        li
        {
            list-style-type: none;
            width: 150px;
            float: left;
            line-height: 80px;/*行內元素不能設置高度,但可以設置行高*/
            text-align: center;/*讓li內的內容水平居中,行內元素默認垂直居中*/
        }
        span
        {
            position: relative; /* li標簽內的字體和圖片中間對齊,讓字體在原來位置top上移幾個像素*/
            top: -5px;
            font-family: "宋體" , "微軟雅黑" , "黑體";
            font-size: 14px;
            color: #000000;
            font-weight: bold;
        }
    </style>
</head>
<body>
    <ul>
        <li>
            <img src="../NewImgs/tu_48.png" /><span>耽誤管理</span></li>
        <li>
            <img src="../NewImgs/tu_48.png" /><span>耽誤管理</span></li>
        <li>
            <img src="../NewImgs/tu_48.png" /><span>耽誤管理</span></li>
        <li>
            <img src="../NewImgs/tu_48.png" /><span>耽誤管理</span></li>
        <li>
            <img src="../NewImgs/tu_48.png" /><span>耽誤管理</span></li>
        <li>
            <img src="../NewImgs/tu_48.png" /><span>耽誤管理</span></li>
    </ul>
</body>
</html>

 結果


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM