レスポンシブサイトを制作しているのですが、画面幅を縮めた時に、右の<div class="news_title_wrap">と左の<div class="info_wrap">が被ってしまいます。
画面幅を縮めても、右の要素と左の要素が被らないようにするには、どのようにすれば良いのでしょうか?
---追記---
基本的な配置は出来ているのですが、Google検証ツールで徐々に画面幅を縮めていくと、スマホ(768px以下)に切り替わる前(1148pxくらい)で<div class="news_title_wrap">の上に<div class="info_wrap">が重なってしまいます。
1148pxはPCの画面サイズかと思いますので、重なるのは何か間違っているのではないかと思い質問させて頂きました。
メディアクエリを細かく設定すれば重ならずにすみそうですが、あまり細かく設定するのもおかしいと思っています。
それでは、よろしくお願いいたします。
html
1<section class="news"> 2 <div class="news_title_wrap"> 3 <div class="news_title_inner"> 4 <h2 class="din text_upper news_title">News</h2> 5 <img src="./img/read_more.png" class="read_more_ico" alt=""> 6 </div> 7 <img src="./img/sp_line_up.png" class="line_news pcNone" alt="線"> 8 </div> 9 10 <div class="info_wrap"> 11 <div> 12 <span class="din info text_upper">Infomation</span> 13 <img src="./img/news_info_bg.png" class="info_bg" alt=""> 14 </div> 15 16 <div> 17 <span class="din info text_upper">Infomation</span> 18 <img src="./img/news_info_bg.png" class="info_bg" alt=""> 19 </div> 20 21 <div> 22 <span class="din info text_upper">Infomation</span> 23 <img src="./img/news_info_bg.png" class="info_bg03" alt=""> 24 </div> 25 </div> 26 </section>
css
1.news{ 2 position: relative; 3 width: 90%; 4 height: 370px; 5 background-image: url("../img/news_bg.jpg"); 6 background-repeat: no-repeat; 7 background-size: cover; 8 margin: 64px auto; 9 margin-bottom: 0; 10} 11.news_title_wrap{ 12 position: absolute; 13 top: 40%; 14 left: 10%; 15} 16.news_title{ 17 display: flex; 18 justify-content: center; 19 align-items: center; 20 font-size: 38px; 21 letter-spacing: 1.2rem; 22} 23.news_title:after{ 24 content: ""; 25 border-top: 2px solid; 26 width: 3rem; 27 margin-left: 30px; 28} 29.read_more_ico{ 30 top: 50%; 31 margin-top: 40px; 32} 33.info_wrap{ 34 position: absolute; 35 top: 54%; 36 right: 10%; 37 -webkit-transform: translateY(-50%); 38 transform: translateY(-50%); 39} 40.info_bg{ 41 position:relative; 42 padding-bottom: 18px; 43} 44.info_bg03{ 45 position: relative; 46 padding-bottom: 0; 47} 48.info{ 49 position: absolute; 50 left:-8%; 51 background-color: #dcc7a0; 52 padding: 4px 20px; 53 margin: 23px 0; 54 z-index: 9999; 55} 56
回答2件
あなたの回答
tips
プレビュー