讓li橫向排列CSS

來源:互聯網
上載者:User

方法一:直接帶<li>裡面加樣式來實現

<ul style=list-style:none;>
<li style="display:inline">我要橫向排列</li>
<li style="display:inline">Adding's Blog</li>
</ul>

方法二:通過定義li的CSS來實現

<style type="text/css">
<!--
li {
 background-color: #CCCCCC;
 text-align: center;
 float: left;
 width: 70px;
 margin: 3px;
 padding: 3px;
 list-style-type: none;
}
-->
</style>
<ul>
  <li>首頁  </li>
  <li>新聞中心</li>
  <li>產品</li>
  <li>線上反饋</li>
  <li>服務</li>
  <li>聯絡
</ul>

</style>
<ul>
  <li>首頁  </li>
  <li>新聞中心</li>
  <li>產品</li>
  <li>線上反饋</li>
  <li>服務</li>
  <li>聯絡
</ul>

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.