<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>圖片項目符號</title>
<style>
ul{
list-style-image: url(apple.png);
}
</style>
</head>
<body>
<h3>蘋果周邊商品</h3>
<ul>
<li>蘋果汁</li>
<li>蘋果麵包</li>
<li>蘋果蛋糕</li>
</ul>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>項目符號位置</title>
<style>
.outside{
list-style-position: outside;
}
.inside{
list-style-position: inside;
}
</style>
</head>
<body>
<h2>大眾運輸交通工具</h2>
<ul class="outside">
<li>公車</li>
<li>火車</li>
<li>捷運</li>
</ul>
---------------------------
<ul class="inside">
<li>公車</li>
<li>火車</li>
<li>捷運</li>
</ul>
</body>
</html>
前面介紹了許多項目清單屬性,若覺得逐條設定很麻煩,可以利用下面這個方式來快速設定。
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>項目清單屬性</title>
<style>
ol{list-style: outside lower-roman ;}
</style>
</head>
<body>
<h3>滅火器使用口訣</h3>
<ol>
<li>拉</li>
<li>瞄</li>
<li>壓</li>
<li>掃</li>
</ol>
</body>
</html>