Possible to set border outline smaller?

It really annoys me how with borders/outlines it surrounds the object from all the way from the left to all the way to the right. Is there any way to set it differently? http://i.imgur.com/uYdkjde.png I’m thinking you would use a div then resize the div but I can’t figure out how to do that.

By default div tags are block level i.e. they take up all the available horizontal space their containing element allows.

Maybe you’re after something like

div.whatever { 
  display: inline-block;
}
2 Likes

Sorry, what does that do?

<center>
<style>#example { 
  display: inline-block;
}
</style>
<div id="example">
<br><br>Example
</div>

Try giving it a border / outline and the difference should be clear

Instead of

inline-block
The element generates a block element box that will be flowed with surrounding content as if it were a single inline box (behaving much like a replaced element would)

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.