有一道 CSS 题目,给大家练练手,稍后公布答案。
题目要求:
- P 标签的最大宽度不可以大于 H2 标签文字宽度的 10%
- H2 标签不能失去高度(h2 文字高度+p 标签高度 = h2 标签高度)
HTML 结构(不允许修改)
<h2>
IPHONE XR<br>
IS THE FUCKING<br>
BEST EVER MADE
<p>iPhone XR has not been authorized as required by the rules of the Federal Communications Commission. iPhone XR is not, and may not be, offered for sale or lease, or sold or leased, until authorization is obtained.</p>
</h2>
基础 CSS 样式
h2{
font-size: 52px;
font-weight: bold;
color: #000;
}
p{
font-size: 12px;
color: #333;
}
初始效果

期望效果
