html - How to apply padding to every line in multi-line text? -
i have background color applied <span> tag, there left , right padding set on it. problem is: padding applied left (beginning) , right (ending) of <span>, not left (beginning) , right (ending) of each line when text wrapped on several lines.
how can apply left , right padding 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 on lazy dog.</span></h1>
you use box-decoration-break property value of clone.
box-decoration-break: clone;each box fragment rendered independently specified border, padding , margin wrapping each fragment. border-radius, border-image , box-shadow, applied each fragment independently. background drawn independently in each fragment means background image background-repeat: no-repeat may repeated multiple times. - mdn
see current browser support tables @ caniuse.com
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;    -webkit-box-decoration-break: clone;    box-decoration-break: clone;  }<h1><span>the quick brown fox jumps on lazy dog.</span></h1>
Comments
Post a Comment