html tutorial - size Attribute in HTML - html5 - html code - html form




Size attribute in html

Learn html - html tutorial - Size attribute in html - html examples - html programs

  • For input elements, the size attribute defines the visible width in characters of an <input> element.
  • For <select> elements, the size attribute defines the number of visible options in a drop-down list.

Syntax for size attribute in HTML:

<element size = “number”>

Applies To:

Element Attribute
<input> size
<select> size

Attribute Values:

Tag Value Description
<input> number Defines the width of an <input> element.
<select> number Defines the number of visible options in the drop-down list.

Sample Coding for size Attribute in HTML:

Tryit<!DOCTYPE html>
<html>
    <head>
         <title>Wikitechy size attribute</title>
    </head>
    <body>
     <h1>Wikitechy HTML size Attribute</h1>
     <select size="4">
     <option value="html">HTML</option>
     <option value="css">CSS</option>
     <option value ="php">PHP</option>
     <option value ="javascript">JavaScript</option>
     <option value ="jquery">JQuery</option>
     <option value ="wordpress">WordPress</option>
     </select>
    </body>
</html>

Code Explanation for size Attribute in HTML:

size Attribute Code Explanation

  1. <select> element is used to display a drop-down list.
  2. size attribute specifies the number of visible options in the drop-down list.
  3. <option> tag specifies list of options to the drop-down list.

Output for size Attribute in HTML:

size Attribute Tag Output

  1. The drop-down list with four (size attribute value is set to 4) visible options has been displayed.

Browser Support for size Attribute in HTML:

Browser
<input> 1.0 2.0 1.0 1.0 1.0
<select> Yes Yes Yes Yes Yes

Related Searches to size attribute in html

Adblocker detected! Please consider reading this notice.

We've detected that you are using AdBlock Plus or some other adblocking software which is preventing the page from fully loading.

We don't have any banner, Flash, animation, obnoxious sound, or popup ad. We do not implement these annoying types of ads!

We need money to operate the site, and almost all of it comes from our online advertising.

Please add wikitechy.com to your ad blocking whitelist or disable your adblocking software.

×