首页htmlui_olHTML Element Style - 如何左对齐列表项的菜单图标

HTML Element Style - 如何左对齐列表项的菜单图标

我们想知道如何左对齐列表项的菜单图标。

<!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://www.w3cschool.cn/style/download.png') no-repeat 0 0;
}
</style>
</head>
<body>
  <ul>
    <li class="icon_name_here">Item1</li>
    <li>Item2</li>
  </ul>
</body>
</html>