Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Show free space at the begining and the end of a text inside a span

I have the following markup to show a span with background-color : lightgrey and color : darkgrey :–

<span class="singleNews__content__info__label">Business News</span>


.singleNews__content__info__label{
    text-transform: uppercase;
    background-color: #d9d9d9;
    color: #5f5f5f;
    text-align: center;}

here is the result:-

enter image description here

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

but i am trying to get this result where there will be some free space at the beginning and at the end of the text:-

enter image description here

so can anyone advice on this please?
Thanks

>Solution :

With padding-left and padding-right you can add space before and after the word. Also with -top and -bottom you can add on the y-direction space.

.paddTheSpan {
  padding-left: 24px;
  padding-right: 24px;
  padding-top: 4px;
  padding-bottom: 4px;
}
.singleNews__content__info__label{
    text-transform: uppercase;
    background-color: #d9d9d9;
    color: #5f5f5f;
    text-align: center;
}
<span class="singleNews__content__info__label paddTheSpan">Business News</span>
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading