Skip to content Skip to sidebar Skip to footer

Css Not Working When Label Tag Placed Before Input Tag?

The switching of the order placement of the two tags (input and label) stops either the function to run or the css to load! I've tried messing around with it but to no avail. I wan

Solution 1:

The + symbol is the next-sibling combinator.

If you swap the order, then the label isn't the next sibling, it is the previous one.

There is no previous sibling combinator (as CSS generally never applies a rule based on something that appears later in the DOM tree (for reasons of performance and to avoid conflicts)).

You might be able to keep the elements in the same DOM order while changing the order they are rendered in by combining a Flexbox layout with the order property.


Post a Comment for "Css Not Working When Label Tag Placed Before Input Tag?"