css - Is HTML label a replaced element? -


first, definition of replaced element from w3 :

replaced element

an element content outside scope of css formatting model, such image, embedded document, or applet. example, content of html img element replaced image "src" attribute designates. replaced elements have intrinsic dimensions: intrinsic width, intrinsic height, , intrinsic ratio. example, bitmap image has intrinsic width , intrinsic height specified in absolute units (from intrinsic ratio can determined). on other hand, other documents may not have intrinsic dimensions (for example, blank html document).

user agents may consider replaced element not have intrinsic dimensions if believed dimensions leak sensitive information third party. example, if html document changed intrinsic size depending on user's bank balance, ua might want act if resource had no intrinsic dimensions.

the content of replaced elements not considered in css rendering model.

it doesn't seem concern label, right?

then, i've seen this blog post, gives 1 rule :

you cannot apply generated content replaced elements. is, cannot apply pseudo-element selectors :before or :after them.

but can.

so, can assume it's not replaced element (i lack of experiences prove opposite).


so, according mdn's doc line-height :

case 1 - on block level elements, line-height css property specifies minimal height of line boxes within element.

case 2 - on non-replaced inline elements, line-height specifies height used in calculation of line box height.

case 3 - on replaced inline elements, buttons or other input element, line-height has no effect.

i set jsfiddles illustrate these behaviors, comparing block element (div) , label :

so, label behave non-replaced element, when comes override line-height, not.

i don't it, have explanation of behavior? label replaced element after all?

on w3.org, i've seen label in phrasing content category, i've seen this post, did not find answer question it.

tests made under chrome 33 (mac).

is html label replaced element?

no

you cannot apply generated content replaced elements. is, cannot apply pseudo-element selectors :before or :after them.

but can.

the quote says can't use :before or :after on replaced elements.

since label not replaced element, can use :before , :after on it.

so aren't seeing contradicts documentation reading.


setting line-height on wrapping form, , override on div , label - not ok, 2 elements behave differently

they should behave differently.

the inline boxes inside form line height form.

the label inline, inline boxes go inside inline boxes form. label's inline boxes smaller inline boxes inside.

the div block element, inline boxes go inside div , not inside inline boxes form.

if make div display: inline compare 2 elements display: inline instead of 1 inline , 1 block , same results each.


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -