I'm working through a tutorial and I have a form that uses float elements. The form currently has all the labels and input boxes next to each other.
To align the form so that everything is on the left the book teaches me to:
Put-> clear: left; as below
label {
float: left;
width: 5em;
text-align: right;
margin-right: .5em;
**clear: left;**
}
input {
background-color: #CCCCFF;
float: left;
clear: right;
The way I understand the clear attribute is that if I set it on a floating element, it means that I want nothing to the left/right/both of that element.
Therefore, in my head, instead of putting the clear attribute on the label, putting that clear:right; on the input should also work (because then nothing can be on the right side of the input box), but of course it doesn't.
There's a gap in my understanding, can someone please point out why putting the clear:right attribute on the inputs won't work the same as putting the clear:left attribute on the label?
Thank you