親要素を画面幅いっぱいに、
子要素を左にコンテンツ、右に画像(各width:50&)を横に並べるレイアウトを設定したいのですが、縮小するとどうしても画像の高さが足りなくなってしまいます。
画像を背景設定すればいいと思ったものの、背景にしてしまうと、高さを設定が昼用で、結局可変すると高さが揃わなくなります。
HTML
1<div class="flex-wrapper"> 2 <div class="content-wrapper"> 3 <h1>TITLE</h1> 4 <p>txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt </p> 5 </div> 6 <div class="img-wrapper"> 7 <img src="https://placehold.jp/3d4070/ffffff/500x700.png" alt=""> 8 </div> 9</div>
css
1img { 2 width: 100%; 3} 4.flex-wrapper { 5 display: flex; 6 flex-wrap: wrap; 7} 8.content-wrapper { 9 width: 50%; 10 background: #aaa; 11 padding: 10%; 12 box-sizing: border-box; 13} 14.img-wrapper { 15 width: 50%; 16}
色々調べたのですが解決できず、
いい方法があれば教えていただきたいです。
よろしくお願いします。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2020/12/23 04:28