答案 0 :(得分:1)
span {
font-size: 2.2rem;
}
.bg-pad {
background: #c0392b;
color: #fff;
line-height: 3rem;
}
<span class="bg-pad">Lorem ipsum dolor sit amet, consectetur adipisicing elit. Fugiat quisquam quas nesciunt quaerat consequatur, illum ipsa accusamus, optio molestias quae id autem praesentium quia, nostrum quis, velit dolorem. Magni, magnam. Lorem ipsum dolor sit amet, consectetur adipisicing elit. Fugiat quisquam quas nesciunt quaerat consequatur, illum ipsa accusamus, optio molestias quae id autem praesentium quia, nostrum quis, velit dolorem. Magni, magnam.</span>
答案 1 :(得分:0)
p {
padding: 5px;
background-color: red;
}
span {
background: #c0392b;
color: #fff;
line-height: 3rem;
}
<p>
lor ut congue egestas, odio urna facilisis tortor, sed tempor ex metus at leo. Maecenas ac sem ut ante porta sodales.</p>
<span>lor ut congue egestas, odio urna facilisis tortor, sed tempor ex metus at leo. Maecenas ac sem ut ante porta sodales.<span>
嗨,您只需要在CSS中放置填充和颜色即可应用样式。如果需要,还可以将文本的背景确定为“ background-color:transparent”,并获得不同的效果。
答案 2 :(得分:0)
您可以将段落放在div中。并为此设置背景
div{
background:orange;
color:white;
}
section{
background:url(https://picsum.photos/458/354);
height:200px;
}
<section>
<div>
<p>Any text wth long description, you can write anything here becuase i have a background form div. and i will not longer see you space behind me.Any text wth long description, you can write anything here becuase i have a background form div. and i will not longer see you space behind me.Any text wth long description, you can write anything here becuase i have a background form div. and i will not longer see you space behind me.
</p>
</div>
</section>