user366312
user366312

Reputation: 16904

CSS box borders

This is a CSS problem. I need to trim the white spaces from a div or list or paragraph.

-------------------------------------------
| This is my Text.                        |
-------------------------------------------

How to convert this div/list/paragraph (i.e. any box) to show like the following when it is needed?

--------------------
| This is my Text. |
--------------------

And the Vice-versa?

This should work regardless of the parent container.

Upvotes: 1

Views: 136

Answers (2)

Quintin Robinson
Quintin Robinson

Reputation: 82335

You could change the style of the elements that contain "This is my Text" to display:inline and that should provide the desired effect.

It's worthy to note that without knowing the entire layout or rather just setting this as the default style may have unforeseen consequences (causing normally blocking elements to not block). A better solution would be to wrap the text in elements that would normally have this effect or apply specific classes to the normally blocking elements to differentiate them.

Upvotes: 3

jerjer
jerjer

Reputation: 8760

div,p,ul,ol,h[1-6] are block elements, you must changed it to inline

<div style="display:inline">some content</div>

Upvotes: 2

Related Questions