目的
- 横並びのシンプルなパンくずリストを作りたい。
- 次の階層がある場合はアングルブラケット(山括弧)を書いて、視覚的に分かりやすい構造にしたい。
- SEOに最適なパンくずリストにしたい。
- h1の置き場所に困っているのでパンくずリストの最後(ページタイトル)に組み込みたい。
実行結果
このパンくずリストは最後の文言がこのような長文になってもキレイに改行されるようになっているので、安心してお使いいただけます。
HTML
<div class="structure_1_2">
<nav>
<ol>
<li><a href="https://note-book.foo/">HOME</a></li>
<li><a href="https://note-book.foo/structure/">構造</a></li>
<li><a href="https://note-book.foo/structure/1/">パンくずリスト</a></li>
<li aria-current="page">このパンくずリストは最後の文言がこのような長文になってもキレイに改行されるようになっているので、安心してお使いいただけます。</li>
</ol>
</nav>
<h1>このパンくずリストは最後の文言がこのような長文になってもキレイに改行されるようになっているので、安心してお使いいただけます。</h1>
</div>
CSS
.structure_1_2 {
font-size: 12px;
line-height: 1.7;
background-color: #FFFFFF;
width: 94%;
padding-top: 0px;
padding-right: 0px;
padding-bottom: 0px;
padding-left: 0px;
margin-top: 0px;
margin-right: auto;
margin-bottom: 0px;
margin-left: auto;
}
.structure_1_2 nav {
display: inline;
}
.structure_1_2 ol {
font-size: 0px;
display: inline;
padding-top: 0px;
padding-right: 0px;
padding-bottom: 0px;
padding-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
margin-left: 0px;
list-style: none;
}
.structure_1_2 ol li {
font-size: 12px;
line-height: 1.7;
display: inline;
}
.structure_1_2 ol li:not(:last-child)::after {
color: #000000;
content: ">";
margin-top: 0px;
margin-right: 8px;
margin-bottom: 0px;
margin-left: 8px;
}
.structure_1_2 ol li[aria-current="page"] {
display: none;
}
.structure_1_2 a {
text-decoration: none;
}
h1 {
font-size: 12px;
line-height: 1.7;
font-weight: normal;
display: inline;
padding-top: 0px;
padding-right: 0px;
padding-bottom: 0px;
padding-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
margin-left: 0px;
}
.structure_1_2 {
font-size: 9px;
line-height: 1.7;
background-color: #FFFFFF;
width: 96%;
margin-top: 0%;
margin-right: auto;
margin-bottom: 2%;
margin-left: auto;
}
.structure_1_2 nav {
display: inline;
}
.structure_1_2 ol {
font-size: 0px;
display: inline;
padding-top: 0%;
padding-right: 0%;
padding-bottom: 0%;
padding-left: 0%;
margin-top: 0%;
margin-right: 0%;
margin-bottom: 0%;
margin-left: 0%;
list-style: none;
}
.structure_1_2 ol li {
font-size: 9px;
line-height: 1.7;
display: inline;
}
.structure_1_2 ol li:not(:last-child)::after {
color: #000000;
content: ">";
margin-top: 0px;
margin-right: 4px;
margin-bottom: 0px;
margin-left: 4px;
}
.structure_1_2 ol li[aria-current="page"] {
display: none;
}
.structure_1_2 a {
text-decoration: none;
}
h1 {
font-size: 9px;
line-height: 1.7;
font-weight: normal;
display: inline;
padding-top: 0px;
padding-right: 0px;
padding-bottom: 0px;
padding-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
margin-left: 0px;
}