user12861
user12861

Reputation: 2426

Percent Width Adds to 100%, But Displayed On Two Lines

This appears on one line:

<label style="display:inline-block;width:30%">xxx</label>
<span style="display:inline-block;width:69%">hey</span>

This appears on 2:

<label style="display:inline-block;width:30%">xxx</label>
<span style="display:inline-block;width:70%">hey</span>

Why?

Upvotes: 0

Views: 116

Answers (1)

Adrift
Adrift

Reputation: 59779

Because inline-block elements are white-space dependent, that 1% is the white-space caused by this display value.

You can either manually remove the white-space between the <label> and the <span> or you can comment the white-space out by starting a comment at the end of one line and ending it on the next

Upvotes: 4

Related Questions