Prev | Current Page 405 | Next

Craig Grannell

"The Essential Guide to CSS and HTML Web Design"

For example,
upon focusing a form field, you might change its background color, making it more obvious
that it??™s the field in focus.
Because the border in the previous code is defined using a class, it can be applied to multiple
elements. The reason we don??™t use a tag selector and apply this style to all input fields
is that radio buttons and check boxes look terrible with rectangular borders around them.
However, applying this style to the select element can work well.
Note that the background color in this example is designed to contrast slightly with the
page??™s background color, but still provide plenty of contrast with any text typed into the
form fields; as always, pick your colors carefully when working with form styles.
The default Submit button style can be amended in a similar fashion, and padding can also
be applied to it. This is usually a good idea because it enables the button to stand out and
draws attention to the text within.
THE ESSENTIAL GUIDE TO CSS AND HTML WEB DESIGN
320
Should you desire a more styled Submit button, you can instead use an image:
?? alt="Submit form" />
Along with the fields and controls, it??™s also possible to style the elements added in the previous
section ???The label, fieldset, and legend elements.??? The fieldset rule applies a
1-pixel dashed line around the elements grouped by the fieldset element, along with
adding some padding and a bottom margin.


Pages:
393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417