HTML Form Default Option

 

HTML Form Default Option

The HTML option tag is used to create options listed in a drop down box of a web page form.

You can select a default option by adding the word "selected" within your option tag.

 

HTML Code

HTML code viewed within an HTML document:
html-line

<select>
<option>option 1</option>
<option selected>option 2</option>
<option>option 3</option>
<option>option 4</option>
<option>option 5</option>
<option>option 6</option>
</select>

Browser View

HTML coding viewed through a web browser:
html-line

HTML Code

HTML code viewed within an HTML document:
html-line

<select>
<option>option 1</option>
<option>option 2</option>
<option>option 3</option>
<option selected>option 4</option>
<option>option 5</option>
<option>option 6</option>
</select>

Browser View

HTML coding viewed through a web browser:
html-line

HTML Code

HTML code viewed within an HTML document:
html-line

<select>
<option>option 1</option>
<option>option 2</option>
<option>option 3</option>
<option>option 4</option>
<option>option 5</option>
<option selected>option 6</option>
</select>

Browser View

HTML coding viewed through a web browser:
html-line

HTML Code

HTML code viewed within an HTML document:
html-line

<select>
<option selected>option 1</option>
<option>option 2</option>
<option>option 3</option>
<option>option 4</option>
<option>option 5</option>
<option>option 6</option>
</select>

Browser View

HTML coding viewed through a web browser:
html-line

 
Creating a default option within your drop down box is a great way to display an option that is most-likely to be selected. However, if your visitor prefers another option, they can easily select another option.

For additional information on creating an HTML form default option, visit the HTML Tutorial section.

Give it a try…

To view the results below, after making changes to the above code, place your cursor at the end of the code and press your space bar on your keyboard.

Here’s the result…

This concludes the HTML form default option code.

 

 

 
Visit the following pages for a wealth of copy and paste codes and tips:

HTML Tips
Copy and paste special effect HTML codes for your web page.

HTML Codes
An HTML codes chart you can use to copy and paste codes into your web page.

HTML Color Codes
An HTML color codes chart you can use to copy and paste color codes into your web page.

JavaScript Codes
Copy and paste special effect JavaScript codes for your web page.

Web Design Tips
Tips, tricks, and special effect codes for your web page.

HTML Tags
A list of HTML tags.

HTML 5 Tags
A list of the latest HTML tags to be developed.

ASCII Codes
Special text characters and code for your web page.