

サンプルコード1 - ul タグに直接指定
ul タグに 「style="list-style: none"」を指定します。<!doctype html>
<html lang="ja">
<head>
<meta charset="UTF-8" />
<title>ul-サンプル</title>
</head>
<body>
<ul style="list-style: none">
<li>Hello</li>
<li>World</li>
</ul>
</body>
</html>
サンプルコード2 - スタイルを定義し、ul タグに class で指定
- head 内で「list-style: none;」を指定したスタイルを定義します。
- 定義したスタイルを ul タグの class で指定します。
<!doctype html>
<html lang="ja">
<head>
<meta charset="UTF-8" />
<title>ul-サンプル</title>
<style>
.no-mark {
list-style: none;
}
</style>
</head>
<body>
<ul class="no-mark">
<li>Hello</li>
<li>World</li>
</ul>
</body>
</html>
サンプルコード3 - 外部CSSファイルでスタイルを定義し、ul タグに class で指定
- CSSファイルに「list-style: none;」を指定したスタイルを定義します。
- CSSファイルを読み込みます。
- 定義したスタイルを ul タグの class で指定します。
.no-mark {
list-style: none;
}
index.html
<!doctype html>
<html lang="ja">
<head>
<meta charset="UTF-8" />
<link rel="stylesheet" href="style.css">
<title>ul-サンプル</title>
</head>
<body>
<ul class="no-mark">
<li>Hello</li>
<li>World</li>
</ul>
</body>
</html>
検証環境
- Google Chrome バージョン: 103.0.5060.114(Official Build) (64 ビット)
- Microsoft Windows 10 Pro Version 21H2 OS Build 19044.1766 Experience: Windows Feature Experience Pack 120.2212.4180.0