.score{
font-size: 20px;
text-align: center;
background-color: white;
width: 700px;
height: 200px;
border: 1px solid white;
border-radius: 0px 0px 10px 10px;
display: block;
margin: 0 auto;
}
.score p span{
padding-top: 100px;
}
<div class="score">
<p>bb<span id="correctAns">jkjh </span></p>
</div>
我想將我的文本向下移動一點,但它不起作用,將填充放在 .score 中只會讓它變大,如果我把它放在 .score p 跨度中,什么也不會發生。
uj5u.com熱心網友回復:
Nepotech 的回答是正確的。另一種方法是line-height用于.score:
.score {
font-size: 20px;
text-align: center;
background-color: white;
width: 700px;
height: 200px;
border: 1px solid white;
border-radius: 0px 0px 10px 10px;
display: block;
line-height: 100px;
}
<div class="score">
<p>bb<span id="correctAns">jkjh </span></p>
</div>
uj5u.com熱心網友回復:
僅margin-top用于p元素
- 注意:我已將顏色更改為
blue,以便更好地理解!
.score{
font-size: 20px;
text-align: center;
background-color: blue;
width: 700px;
height: 200px;
border: 1px solid white;
border-radius: 0px 0px 10px 10px;
display: block;
margin: 0 auto;
}
p{
margin-top: 100px;
}
<div class="score">
<p>bb<span id="correctAns">jkjh </span></p>
</div>
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/440321.html
上一篇:無法洗掉CSV中Pandas Gibberish輸出中的空白空間
下一篇:不顯示背景圖片
