Question:
How do you add padding to the beginning and end of each line of text within a span element that has a background color?
Answer:
CSS Solution:
This solution requires using inline blocks and careful positioning:
div { line-height: 1.1; padding: 1px 0; border-left: 30px solid #000; display: inline-block; } h3 { background-color: #000; color: #fff; display: inline; margin: 0; padding: 0 } h3 .indent { position: relative; left: -15px; } h3 .subhead { padding: 0 15px; float: left; margin: 3px 0 0 -29px; outline: 1px solid #00a3d0; line-height: 1.15 }
HTML Markup:
<div>
The above is the detailed content of How to add padding to the beginning and end of each line of text within a span element with a background color?. For more information, please follow other related articles on the PHP Chinese website!