HTML and CSS Reference
In-Depth Information
Setting the autocomplete Attribute
Many browsers include an autocomplete feature that automatically fills in input form
values if they are based on previously filled out forms. For example, a user who routinely
fills in his or her street address in a multitude of Web forms can enable the browser to
remember the information and to insert it automatically when the browser encounters
another street address field in another form.
The autocomplete feature is a useful time-saver in most cases, but it also can be a
security risk for a personal computer located in a public place. After all, you may not
want to have a private credit card number or password automatically filled in by a
browser on a computer that other people will be using.
One way to prevent this problem is by implementing the HTML5 autocomplete attri-
bute. The autocomplete attribute can be added to a form or input element to turn off
(or turn on) the form complete feature. For example, the input element
<input name=”creditcardnumber” autocomplete=”false” />
prevents browsers from automatically filling in the creditcardnumber field, even if
they have credit card data handy. Currently, the a utocomplete attribute is supported
by Opera and Firefox, but not by Safari, Chrome, or Internet Explorer. However, you
may want to consider using it if you want to add another level of security to confidential
information.
Applying a Style Sheet to a Web Form
Alice stops by to see your progress on the survey form. In its current state, the form is
difficult to read and she wants you to replace the default styles for the form with your
own customized style sheet. First, she wants the two field sets to be floated side-by-side
within the main section of the page and resized to be about half the width of the Web
page. You'll add a style rule to an external style sheet file to modify the appearance of
these field sets.
To create the form style sheet:
1. Use your text editor to open the formstxt.css file from the tutorial.06\tutorial
folder. Enter your name and the date in the comment section of the file, and then
save it as forms.css in the same folder.
2. Below the comment section, add the following style rule as shown in Figure 6-16:
/* Field set styles */
fieldset {
background-color: rgb(255, 246, 205);
border: 1px solid rgb(233, 69, 0);
float: left;
margin: 10px 0px 10px 2.5%;
width: 46%;
}
Search WWH ::




Custom Search