我的 CSS 有问题,当我调整屏幕大小时,它不会折叠,知道为什么吗?这假设位于屏幕的中心,我希望它保持在中心,但在屏幕分辨率改变时调整大小
这是我的代码:
<div style="position:relative; width:900px; margin:auto; text-align:center; font-size:25px;">
<div style="margin-top:70px;">
<p style="line-height:1">some textttttttttt</p>
<p style="line-height:1">Another texthghghghgh </p>
<p style="margin-top:30px">different stuff here :</p>
<h2 style="color:#EE3969; font-size:45px"> first</h2>
<h2 style="color:#DE9540; font-size:45px"> second</h2>
<h2 style="color:#00AAC2; font-size:45px"> third</h2>
</div>
</div>
谢谢
最佳答案
用此替换代码的第一行
<div style="position: relative; width: 100%; margin:auto; text-align: center; font-size: 25px;">
关于html - CSS 在较小屏幕上调整 DIV 大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23571507/