I have background color applied to the <span>
tag, there is also left and right padding
set on it. The problem is: the padding
is applied only to the left (beginning) and right (ending) of the <span>
, not the left (beginning) and right (ending) of each line when the text is wrapped on several lines.
How can I apply the left and right padding
to the middle lines?
h1 {
font-weight: 800;
font-size: 5em;
line-height: 1.35em;
margin-bottom: 40px;
color: #fff;
}
h1 span {
background-color: rgba(0, 0, 0, 0.5);
padding: 0 20px;
}
<h1><span>The quick brown fox jumps over the lazy dog.</span></h1>
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…