MozillaZine

why don't inline-block elements shrink wrap when text wraps

Discuss how to use and promote Web standards with the Mozilla Gecko engine.
Bethrezen
 
Posts: 405
Joined: September 13th, 2003, 11:56 am

Post Posted August 13th, 2019, 6:55 am

Hi all

So I have a devilishly tricky issue, here is a screen shot to explain.

Image

In this screen shot you can clearly see the problem, in the box on the left the anchor is set to display: inline-block; and shrink wraps its text as expected.

However in the box or the right something is wrong, the text has wrapped to a new line since it's too big to fit on one line, yet despite also being set to display: inline-block the anchor fails to shrink wrap its text.

Now As you can see in this screen shot

Image

If I explicitly set a line brake via the <br> tag, then the anchor correctly shrink wraps its text as expected.

So my question is how can I get the anchor to shrink wrap its text when that text wraps to a new line without having to go through the html adding zillions of brake tags which is rather messy.

Surly there is a better way ?!?!

jscher2000

User avatar
 
Posts: 10704
Joined: December 19th, 2004, 12:26 am
Location: Silicon Valley, CA USA

Post Posted Yesterday, 12:20 pm

Why use inline-block instead of defaulting to inline?

Return to Web Development / Standards Evangelism


Who is online

Users browsing this forum: No registered users and 3 guests