Lee360TheCoder
Lee360TheCoder

Reputation: 37

How do I stop my boxes from stretching?

how do I stop this box from stretching? Here's the code and the result:

CSS:

.social {
    padding-left: 1000px;
    border: 5px inset black;
    margin: 4px;
    width: 100px;
}

HTML:

<div class="social">
    <p>Social</p>
</div>

Result:

enter image description here

Upvotes: 0

Views: 227

Answers (1)

Jimmy Breck-McKye
Jimmy Breck-McKye

Reputation: 3034

As commenters have pointed out, your 1000px padding is adding the space. That's what the padding property does - it adds padding.

If you want 'social' to live in a 100px left column (my guess looking at your styles), remember that you will need to float your column, set it as an inline block, or lay it out with either CSS tables or flexbox.

Upvotes: 1

Related Questions