#section内全てに適用するにはどうすればよいでしょうか。
基本的なことですみません。
css
1background-color: red;
上記をタイトルやテキストが記載されてる箇所(赤枠内の白全て)に適用したいです。
発生している問題・エラーメッセージ
html
1<!DOCTYPE html> 2<html lang="ja"> 3<head> 4 <meta charset="UTF-8"> 5 <meta http-equiv="X-UA-Compatible" content="IE=edge"> 6 <meta name="viewport" content="width=device-width, initial-scale=1.0"> 7 <title>title</title> 8 <link rel="stylesheet" href="./css/style.css"> 9</head> 10<body> 11 <div class="container"> 12 <main> 13 <section id="section"> 14 <div class="inner"> 15 <h2 class="section-title">タイトル</h2> 16 <ol class="section-list"> 17 <li>テキストテキストテキストテキストテキストテキストテキストテキスト</li> 18 <li>テキストテキストテキストテキストテキストテキストテキストテキスト</li> 19 <li>テキストテキストテキストテキストテキストテキストテキストテキスト</li> 20 <li>テキストテキストテキストテキストテキストテキストテキストテキスト</li> 21 <li>テキストテキストテキストテキストテキストテキストテキストテキスト</li> 22 </ol> 23 </div> 24 </section> 25 </main> 26 </div> 27</body> 28</html>
css
1* { 2 margin: 0; 3 padding: 0; 4 box-sizing: border-box; 5 background-color: #f4f9ff; 6 color: #333; 7 font-size: 0.875rem; 8 font-family: Meiryo; 9} 10 11.container { 12 max-width: 1000px; 13 margin: 0 auto; 14} 15 16.inner { 17 max-width: 600px; 18 margin: 0 auto; 19} 20 21.section-title { 22 font-size: 1.125rem; 23 font-weight: bold; 24 margin-bottom: 10px; 25} 26 27#section { 28 background-color: red; 29 padding: 30px 0; 30} 31 32#section .section-list { 33 margin-left: 20px; 34} 35 36#section .section-list li { 37 margin-bottom: 20px; 38}
試したこと
.inner
にbackground-color: red;
を記載。
どうぞよろしくお願いいたします。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2021/09/02 00:34 編集