前提・実現したいこと
IEのブラウザ表示において、flexboxを適用したボックス内のpタグ同士の重なりを無くしたい。
経緯
- コーディングでニュース欄を作成しています。
- IEで表示確認をした所、flexboxを適用して横並びにした、
pタグ[日付・ラベル] と pタグ[文章] が重なってしまい対処に苦戦しています。
- Chrome、Firefoxでは重なることがなく、適切に表示されます。
- HTMLとCSSのコードは以下です。
html
1<!DOCTYPE html> 2<html lang="ja"> 3<head> 4 <meta charset="UTF-8"> 5 <meta name="viewport" content="width=device-width, initial-scale=1.0"> 6 <meta http-equiv="X-UA-Compatible" content="ie=edge"> 7 <title>NEWS</title> 8</head> 9<body> 10 <section id="news"> 11 <h3 class="section__heading"><a href="#">News</a></h3> 12 <ul class="news__list"> 13 <li class="news__item"> 14 <p class="news__heading"><time datetime=">2019-01-30">2019-01-30</time><a href="#">ラベル1</a></p> 15 <p class="news__text">ニュースニュースニュースニュースニュースニュースニュースニュースニュース</p> 16 </li> 17 <li class="news__item"> 18 <p class="news__heading"><time datetime=">2019-01-30">2019-01-30</time><a href="#">ラベル2</a></p> 19 <p class="news__text">ニュースニュースニュースニュースニュースニュースニュースニュースニュース</p> 20 </li> 21 <li class="news__item"> 22 <p class="news__heading"><time datetime=">2019-01-30">2019-01-30</time><a href="#">ラベル3</a></p> 23 <p class="news__text">ニュースニュースニュースニュースニュースニュースニュースニュースニュース</p> 24 </li> 25 <li class="news__item"> 26 <p class="news__heading"><time datetime=">2019-01-30">2019-01-30</time><a href="#">ラベル1</a></p> 27 <p class="news__text">ニュースニュースニュースニュースニュースニュースニュースニュースニュースニュースニュースニュースニュース</p> 28 </li> 29 <li class="news__item"> 30 <p class="news__heading"><time datetime=">2019-01-30">2019-01-30</time><a href="#">ラベル1</a></p> 31 <p class="news__text">ニュースニュースニュースニュースニュースニュースニュースニュースニュース</p> 32 </li> 33 </ul> 34 <a href="#">more<i class="fa fa-angle-right"></i></a> 35 </section> 36</body> 37
css
1* { 2 margin: 0; 3} 4li { 5 list-style: none; 6} 7body { 8 font-size: 16px; 9} 10section { 11 padding: 70px 0; 12} 13section .section__heading { 14 font-size: 60px; 15 display: flex; 16 justify-content: center; 17 position: relative; 18} 19section .section__heading a { 20 color: #333; 21} 22section .section__heading a::before { 23 content: ''; 24 display: inline-block; 25 width: 70px; 26 height: 5px; 27 background-color: #3F51B5; 28 position: absolute; 29 transform: translateX(60%); 30 bottom: -40%; 31} 32#news { 33 margin: 0 230px; 34} 35 36.news__list { 37 margin-top: 100px; 38} 39 40.news__item { 41 padding: 15px 10px; 42 display: flex; 43 display: -webkit-box; 44 display: -ms-flexbox; 45 align-items: center; 46} 47 48.news__item:not(:last-child) { 49 border-bottom: 1px solid #707070; 50} 51 52.news__item:nth-of-type(2) a { 53 background-color: #3F51B5; 54} 55 56.news__item:nth-of-type(3) a { 57 background-color: #E81919; 58} 59 60.news__item a { 61 transition: all 0.2s ease; 62} 63 64.news__item a:hover { 65 opacity: 0.6; 66} 67 68.news__heading { 69 white-space: nowrap; 70 display: flex; 71 display: -webkit-box; 72 display: -ms-flexbox; 73 align-items: center; 74 margin-right: 1.1em; 75} 76 77.news__heading a { 78 white-space: nowrap; 79 color: #fff; 80 margin-left: 1.1em; 81 padding: 5px 20px; 82 background-color: #666; 83 border-radius: 6px; 84} 85 86#news > a { 87 margin-top: 20px; 88 color: #E81919; 89 font-weight: bold; 90 display: block; 91 text-align: center; 92} 93 94#news > a i { 95 color: #E81919; 96 margin-left: 5px; 97 vertical-align: middle; 98}
試したこと
- ボックスに [-webkit-box] [-ms-flexbox] の適用
- pタグにwidthの設定(意味ありませんでした...)
検索で調べて実証したのですが、上手くいかず投稿させて頂きました。
ご存じの方いましたら、ご教示いただけますと幸いです。
お忙しい所恐縮ですが、何卒よろしくお願いいたします。
環境
- PC:Windows10
- エディタ:VSCode
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2020/01/30 10:44