HTML and CSS Reference
In-Depth Information
As you can see in Figure 11-11, we are now much closer to our desired result.
Figure 11-11.
Form fields with a predictable width have been individually styled.
However, we still have something strange going on in our “Credit card”
fieldset
. We set
the width of input elements to
12em
, and that is getting applied to our radio button inputs and
submit button as well. This can be solved using the CSS attribute selector:
input[type=radio],
input[type=submit],
input[type=checkbox] {
width: auto;
}
Here, we are saying that any
input
element whose
type
attribute is set to
radio
,
submit
, or
checkbox
should have its width set automatically, overriding our previous specification of
12em
.
Figure 11-12 shows the result.