前提・実現したいこと
擬似要素を使ってテキストの前に矢印を入れたいのだが改行されてしまう。
これを改行されないでテキストの前に表示させたい。
発生している問題・エラーメッセージ
擬似要素を使ってテキストの前に矢印を入れたいのだが改行されて表示される。
該当のソースコード
html
1 <ul class="menu"> 2 <li class="menu__mega"> 3 <a href="#" class="init-bottom"></a> 4 <ul class="menu__second-level"> 5 <li><a href="#"><span class="large"><i class="fas fa-hospital-alt"></i></span></a></li> 6 //この下のliに適用させたい 7 <li><a href="#"></a></li> 8 </ul> 9 </li> 10</ul>
sass
1.menu { 2 position: relative; 3 width: 100%; 4 height: 50px; 5 max-width: 1000px; 6 margin: 0 auto; 7 background-color: $gnav-back; 8 9} 10 11.menu > li { 12 float: left; 13 width: calc(100%/3); /* グローバルナビ4つの場合 */ 14 height: 50px; 15 line-height: 50px; 16 text-align: center; 17} 18 19.menu > li a { 20 display: block; 21} 22 23.menu{ 24 .menu__mega{ 25 .init-bottom{ 26 color: #fff; 27 text-decoration: none; 28 &:hover{ 29 background-color: $gnav-hover__back; 30 } 31 } 32 } 33} 34 35.menu__second-level{ 36 .large{ 37 font-size: 2.0rem; 38 text-decoration: none; 39 i{ 40 color: #8d9ada; 41 margin: 0 8px; 42 } 43 } 44 li{ 45 &:nth-child(n+4){ 46 text-indent: -1; 47 padding-left: 3em; 48 &::before{ 49 content: ''; 50 width: 0; 51 height: 0; 52 border-style: solid; 53 border-width: 5px 0 5px 7px; 54 border-color: transparent transparent transparent #007bff; 55 display: inline-block; 56 vertical-align: middle; 57 position: relative; 58 top: -2px; 59 margin-right: 3px; 60 } 61 } 62 } 63 64} 65 66 67.menu > li:hover { 68 background: $gnav-back; 69 -webkit-transition: all .5s; 70 transition: all .5s; 71} 72 73.menu > li a:hover { 74 text-decoration: none; 75 76} 77 78ul.menu__second-level { 79 visibility: hidden; 80 opacity: 0; 81 z-index: 1; 82 83} 84 85 86 87.menu__second-level li { 88 border-top: 1px solid #111; 89 90 91} 92 93 94/* 下矢印 */ 95.init-bottom:after { 96 content: ''; 97 display: inline-block; 98 width: 6px; 99 height: 6px; 100 margin: 0 0 0 15px; 101 border-right: 1px solid #fff; 102 border-bottom: 1px solid #fff; 103 -webkit-transform: rotate(45deg); 104 -ms-transform: rotate(45deg); 105 transform: rotate(45deg); 106} 107 108/* floatクリア */ 109.menu:before, 110.menu:after { 111 content: " "; 112 display: table; 113} 114 115.menu:after { 116 clear: both; 117} 118 119.menu { 120 *zoom: 1; 121} 122 123//mega 124li.menu__mega ul.menu__second-level { 125 position: absolute; 126 top: 40px; 127 left: 0; 128 box-sizing: border-box; 129 width: 100%; 130 padding: 20px 2%; 131 background: $second-li__back; 132 -webkit-transition: all .2s ease; 133 transition: all .2s ease; 134 box-shadow: 0 0 8px gray; 135} 136 137li.menu__mega:hover ul.menu__second-level { 138 top: 50px; 139 visibility: visible; 140 opacity: 1; 141} 142 143li.menu__mega ul.menu__second-level > li { 144 float: left; 145 width: calc(100%/3); 146 border: none; 147 text-align: left; 148} 149 150li.menu__mega ul.menu__second-level > li:nth-child(1n+2) { 151 152}
試したこと
補足情報(FW/ツールのバージョンなど)
ここにより詳細な情報を記載してください。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。