Page 104 - HTML5
P. 104

Syntax


         <input type="text">


        or (without specifying a type, using the default attribute):


         <input>


        The default width of a text field input is 20 characters. This can be changed by specifying a value
        for the size attribute like this:


         <input type="text" size="50">


        The size attribute is distinctly different than setting a width with CSS. Using a width defines a
        specific value (in number of pixel, percentage of the parent element, etc.) that the input must
        always be wide. Using the size calculates the amount of width to allocate based on the font being
        used and how wide the characters normally are.


        Note: Using the size attribute does not inherently limit the number of characters which can be
        entered into the box, only how wide the box is displayed. For limiting the length, see Input
        Validation.

        An input field only allows one line of text. If you need a multi-line text input for substantial amount
        of text, use a <textarea> element instead.


        Search


        5


        Input type search is used for textual search. It will add magnifier symbol next to space for text on
        most browsers


         <input type="search" name="googlesearch">


        DateTime (Global)


        The input element with a type attribute whose value is "datetime" represents a control for setting
        the element’s value to a string representing a global date and time (with timezone information).


         <fieldset>
            <p><label>Meeting time: <input type=datetime name="meeting.start"></label>
         </fieldset>


        Permitted attributes:


            •  global attributes
            •  name
            •  disabled


        https://riptutorial.com/                                                                               88
   99   100   101   102   103   104   105   106   107   108   109