App下載
首頁(yè)htmlui_olHTML Element Style - 如何左對(duì)齊列表項(xiàng)的菜單圖標(biāo)

HTML Element Style - 如何左對(duì)齊列表項(xiàng)的菜單圖標(biāo)

我們想知道如何左對(duì)齊列表項(xiàng)的菜單圖標(biāo)。

<!DOCTYPE html>
<html>
<head>
<style>
ul {
  margin: 0;
  padding: 0;
}

ul li {
  padding: 4px;
}

.icon_name_here:before {
  content: '';
  width: 24px;
  height: 24px;
  display: block;
  float: left;
  padding: 4px;
  background: url('http://m.o2fo.com/style/download.png') no-repeat 0 0;
}
</style>
</head>
<body>
  <ul>
    <li class="icon_name_here">Item1</li>
    <li>Item2</li>
  </ul>
</body>
</html>