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

How do I make a gap between this text and the text background?

right now my div looks like this:

    .codeText{
                background-color: #2C3E50 ;
                color: white;
                display:inline-block;
                border-radius: 25px;
             }

when I use it on a <p> like this:

<div class="codeText">
            <p> <code>&lt;p&gt;This is a paragraph &lt;/p&gt;</code></p>
        </div>

The output looks like this:

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

Code output screenshot

What I want is for there to be a little gap between the text and the background. (gaps on the red arrows shown on the screenshot)

edit: I want to implement this into the .codeText{} and not inline so I can use in multiple areas

>Solution :

You could add some padding and width to the codeText

.codeText {
    background-color: #2C3E50;
    color: white;
    display:inline-block;
    border-radius: 25px;
    padding-inline: 10px;
}
<div class="codeText">
      <p> <code>&lt;p&gt;This is a paragraph &lt;/p&gt;</code></p>
  </div>
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