前提・実現したいこと
p要素の幅をwidthを指定した親要素の幅に収めたい。
発生している問題・エラーメッセージ
p要素が親要素の幅を超えて表示されてしまう。
初めての質問で鵜明確な部分もあるかもしれませんが、ぜひとも回答よろしくお願いします。
該当のソースコード
html
1 <section id="modal"> 2 <h2>Hello!</h2> 3 <div class="text-content"> 4 <p>hello!hello!hello!hello!!hello!hello!hello!hello!hello!hello!hello!hello!hello!hello!hello!hello!hell! 5 </p> 6 </div> 7 <div id="close">閉じる</div> 8 </section>
css
1#modal{ 2 border:gray solid 1px; 3 width:70%;; 4 text-align:center; 5 border-radius:4px; 6 margin:0 auto; 7 padding:0 10px; 8 position:absolute; 9 top:40px; 10 left:0; 11 right:0; 12 background:white; 13} 14.text-content{ 15 width:70%; 16}
試したこと
親要素の幅と同じ幅をp要素に指定したり、p要素をdivタグで囲ったりした。
word-wrapなども指定してみた。
補足情報(FW/ツールのバージョンなど)
回答1件
あなたの回答
tips
プレビュー