目的
- 左にロゴ・住所・電話番号などの会社情報を入れ、右に各メニューを列挙したい(スマホ版は上下に配置してアコーディオンメニュー)。
実行結果
プログラミング備忘録 foo
〒123-4567
東京都○○区○○町
TEL:1234-567-890
FAX:1234-567-891
HTML
<footer>
<div class="structure_5_1">
<div>
<div><img src="../../image/example-logo.png" /></div>
<div>プログラミング備忘録 foo</div>
<div>〒123-4567<br />東京都○○区○○町<br />TEL:1234-567-890<br />FAX:1234-567-891</div>
</div>
<div>
<div><span><a href="https://note-book.foo/">HOME</a></span><a href="https://note-book.foo/#news">新着情報</a><a href="https://note-book.foo/inquiry/">お問い合わせ</a></div>
<div><span><a href="https://note-book.foo/layout/">装飾</a></span><a href="https://note-book.foo/layout/2/">見出し</a><a href="https://note-book.foo/layout/4/">テキスト+画像</a><a href="https://note-book.foo/layout/5/">画像メニュー</a><a href="https://note-book.foo/layout/3/">リスト</a><a href="https://note-book.foo/layout/6/">テーブル</a><a href="https://note-book.foo/layout/1/">均等横並び</a></div>
<div><span><a href="https://note-book.foo/structure/">構造</a></span><a href="https://note-book.foo/structure/3/">新着情報</a><a href="https://note-book.foo/structure/1/">パンくずリスト</a><a href="https://note-book.foo/structure/5/">フッター</a><a href="https://note-book.foo/structure/2/">タブメニュー</a><a href="https://note-book.foo/structure/4/">ドロップダウンメニュー</a></div>
<div><span><a href="https://note-book.foo/management/">管理</a></span><a href="https://note-book.foo/management/1/">.htaccess</a><a href="https://note-book.foo/management/2/">パス</a></div>
</div>
</div>
</footer>
<footer>
<div class="structure_5_1">
<div>
<div><img src="../../image/example-logo.png" /></div>
<div>
<div>プログラミング備忘録 foo</div>
<div>〒123-4567<br />東京都○○区○○町<br />TEL:1234-567-890<br />FAX:1234-567-891</div>
</div>
</div>
<div>
<div>
<input type="checkbox" id="structure_5_1_home">
<label for="structure_5_1_home">HOME</label>
<div>
<a href="https://note-book.foo/#news">新着情報</a>
<a href="https://note-book.foo/inquiry/">お問い合わせ</a>
</div>
</div>
<div>
<input type="checkbox" id="structure_5_1_layout">
<label for="structure_5_1_layout">装飾</label>
<div>
<a href="https://note-book.foo/layout/2/">見出し</a>
<a href="https://note-book.foo/layout/4/">テキスト+画像</a>
<a href="https://note-book.foo/layout/5/">画像メニュー</a>
<a href="https://note-book.foo/layout/3/">リスト</a>
<a href="https://note-book.foo/layout/6/">テーブル</a>
<a href="https://note-book.foo/layout/1/">均等横並び</a>
</div>
</div>
<div>
<input type="checkbox" id="structure_5_1_structure">
<label for="structure_5_1_structure">構造</label>
<div>
<a href="https://note-book.foo/structure/3/">新着情報</a>
<a href="https://note-book.foo/structure/1/">パンくずリスト</a>
<a href="https://note-book.foo/structure/5/">フッター</a>
<a href="https://note-book.foo/structure/2/">タブメニュー</a>
<a href="https://note-book.foo/structure/4/">ドロップダウンメニュー</a>
</div>
</div>
<div>
<input type="checkbox" id="structure_5_1_management">
<label for="structure_5_1_management">管理</label>
<div>
<a href="https://note-book.foo/management/1/">.htaccess</a>
<a href="https://note-book.foo/management/2/">パス</a>
</div>
</div>
</div>
</div>
</footer>
CSS
footer {
}
.structure_5_1 {
background-color: #F6F6F6;
display: flex;
width: 94%;
padding-top: 10px;
padding-right: 10px;
padding-bottom: 10px;
padding-left: 10px;
margin-top: 0px;
margin-right: auto;
margin-bottom: 0px;
margin-left: auto;
}
.structure_5_1 > div:first-child {
width: 25%;
margin-top: 0px;
margin-right: 10px;
margin-bottom: 0px;
margin-left: 0px;
}
.structure_5_1 > div:first-child > div {
margin-top: 0px;
margin-right: 0px;
margin-bottom: 10px;
margin-left: 0px;
}
.structure_5_1 > div:first-child > div:nth-child(1) {
text-align: center;
}
.structure_5_1 > div:first-child > div:nth-child(1) img {
width: 80%;
}
.structure_5_1 > div:first-child > div:nth-child(2) {
font-size: 12px;
font-weight: bold;
text-align: center;
}
.structure_5_1 > div:first-child > div:nth-child(3) {
font-size: 12px;
line-height: 1.7;
text-align: right;
}
.structure_5_1 > div:last-child {
flex-grow: 1;
flex-shrink: 1;
flex-basis: 0;
display: flex;
}
.structure_5_1 > div:last-child > div {
flex-grow: 1;
flex-shrink: 1;
flex-basis: 0;
padding-top: 0px;
padding-right: 5px;
padding-bottom: 0px;
padding-left: 10px;
border-left-style: dotted;
border-left-width: 1px;
border-left-color: #333333;
}
.structure_5_1 > div:last-child > div:last-child {
border-right-style: dotted;
border-right-width: 1px;
border-right-color: #333333;
}
.structure_5_1 > div:last-child > div span a {
font-size: 16px;
line-height: 1;
font-weight: bold;
color: #4B4B4B;
text-decoration: underline;
display: block;
padding-top: 0px;
padding-right: 0px;
padding-bottom: 12px;
padding-left: 0px;
}
.structure_5_1 > div:last-child > div a {
font-size: 14px;
color: #4B4B4B;
text-decoration: none;
display: block;
padding-top: 0px;
padding-right: 0px;
padding-bottom: 12px;
padding-left: 0px;
}
.structure_5_1 > div:last-child > div a:hover {
opacity: 0.7;
}
footer {
}
.structure_5_1 {
display: flex;
flex-direction: column;
width: 100%;
margin-top: 10px;
margin-right: 0px;
margin-bottom: 0px;
margin-left: 0px;
}
.structure_5_1 > div:first-child {
display: flex;
align-items: center;
width: 94%;
margin-top: 0px;
margin-right: auto;
margin-bottom: 10px;
margin-left: auto;
}
.structure_5_1 > div:first-child > div:nth-child(1) {
width: 25%;
}
.structure_5_1 > div:first-child > div:nth-child(1) img {
width: 100%;
}
.structure_5_1 > div:first-child > div:nth-child(2) {
flex-grow: 1;
flex-shrink: 1;
flex-basis: 0;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
margin-left: 15px;
}
.structure_5_1 > div:first-child > div:nth-child(2) > div:nth-child(1) {
font-size: 16px;
font-weight: bold;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 5px;
margin-left: 0px;
}
.structure_5_1 > div:first-child > div:nth-child(2) > div:nth-child(2) {
font-size: 14px;
line-height: 1.7;
}
.structure_5_1 > div:last-child {
display: flex;
flex-direction: column;
width: 100%;
}
.structure_5_1 > div:last-child > div {
border-bottom: solid 1px #DDDDDD;
position: relative;
}
.structure_5_1 > div:last-child > div input {
display: none;
}
.structure_5_1 > div:last-child > div label {
font-size: 17px;
font-weight: bold;
color: #4B4B4B;
background-color: #F5F5F5;
display: block;
padding-top: 15px;
padding-right: 0px;
padding-bottom: 15px;
padding-left: 15px;
cursor: pointer;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
.structure_5_1 > div:last-child > div label::after {
content: "+";
position: absolute;
right: 20px;
}
.structure_5_1 > div:last-child > div > div {
background-color: #FBFBFB;
max-height: 0;
overflow: hidden;
transition: max-height 0.2s ease-out;
}
.structure_5_1 > div:last-child > div > div a {
font-size: 16px;
color: #4B4B4B;
display: block;
padding-top: 10px;
padding-right: 10px;
padding-bottom: 10px;
padding-left: 20px;
text-decoration: none;
border-top: solid 1px #F6F6F6;
}
.structure_5_1 > div:last-child > div input:checked + label + div {
max-height: 500px;
}
.structure_5_1 > div:last-child > div input:checked + label::after {
content: "-";
}