HTML <input> dirname Attribute

Example An HTML form where the field’s text direction will be submitted: <form action=”/action_page.php”> First name: <input type=”text” name=”fname” dirname=”fname.dir”> <input type=”submit” value=”Submit”> </form> Try it Yourself » Definition and Usage The dirname attribute enables the submission of the text direction of the input field The dirname attribute’s value is always the name of the input field, followed by “.dir”. Browser Support […]

HTML <input> checked Attribute

Example An HTML form with a pre-selected checkbox: <form action=”/action_page.php”> <input type=”checkbox” name=”vehicle” value=”Bike”> I have a bike<br> <input type=”checkbox” name=”vehicle” value=”Car” checked> I have a car<br> <input type=”submit” value=”Submit”> </form> Try it Yourself » Definition and Usage The checked attribute is a boolean attribute. When present, it specifies that an <input> element should be pre-selected (checked) when the page loads. The checked attribute can be used […]

HTML <input> autofocus Attribute

Example Let the “First name” input field automatically get focus when the page loads: <form action=”/action_page.php”> First name: <input type=”text” name=”fname” autofocus><br> Last name: <input type=”text” name=”lname”><br> <input type=”submit”> </form> Try it Yourself » Definition and Usage The autofocus attribute is a boolean attribute. When present, it specifies that an <input> element should automatically get focus when the page loads. Browser Support The numbers […]

HTML <input> autocomplete Attribute

Example An HTML form with autocomplete on (and off for one input field): <form action=”/action_page.php” autocomplete=”on”> First name:<input type=”text” name=”fname”><br> Last name: <input type=”text” name=”lname”><br> E-mail: <input type=”email” name=”email” autocomplete=”off”><br> <input type=”submit”> </form> Try it Yourself » Definition and Usage The autocomplete attribute specifies whether or not an input field should have autocomplete enabled. Autocomplete allows the browser to predict the value. When a user starts to […]

HTML <input> alt Attribute

Example An HTML form with an image that represents the submit button: <form action=”/action_page.php”> First name: <input type=”text” name=”fname”><br> <input type=”image” src=”submit.gif” alt=”Submit” width=”48″ height=”48″> </form> Try it Yourself » Definition and Usage The alt attribute provides an alternate text for the user, if he/she for some reason cannot view the image (because of slow connection, an error in the src attribute, or if […]

HTML <input> align Attribute

Example An HTML form with an image as a submit button. The submit button is aligned to the right: <form action=”/action_page.php”> First name: <input type=”text” name=”fname”><br> <input type=”image” src=”submit.gif” alt=”Submit” align=”right” width=”48″height=”48″> </form> Try it Yourself » Definition and Usage The align attribute is only used with <input type=”image”> and it specifies the alignment of the image input according to surrounding elements. Browser Support […]

HTML <img> border Attribute

Example An image with a 5 pixels thick border: <img src=”smiley.gif” alt=”Smiley face” border=”5″> Try it Yourself » Definition and Usage The border attribute specifies the width of the border around an image. Note: An image has no border by default. Browser Support Attribute border Yes Yes Yes Yes Yes The border attribute is deprecated, but still supported in […]

HTML <img> width Attribute

Example An image with a height and a width of 42 pixels: <img src=”smiley.gif” alt=”Smiley face” height=”42″ width=”42″> Try it Yourself » The width attribute specifies the width of an image, in pixels. Tip: Always specify both the height and width attributes for images. If height and width are set, the space required for the image is reserved when the page is […]

HTML <img> vspace Attribute

Example An image with a 50 pixels margin on top and bottom: <p><img src=”smiley.gif” alt=”Smiley face” vspace=”50″> This is some text. This is some text. This is some text.</p> Try it Yourself » Definition and Usage The vspace attribute specifies the whitespace on top and bottom of an image. Browser Support Attribute vspace Yes Yes Yes Yes Yes Compatibility […]

HTML <img> src Attribute

Example An image is marked up as follows: <img src=”smiley.gif” alt=”Smiley face”> Try it Yourself » Definition and Usage The required src attribute specifies the URL of the image. Note: When a web page loads; it is the browser, at that moment, that gets the image from a web server and inserts it into the page. Therefore, make […]

HTML <img> longdesc Attribute

Example Several examples of how to use the longdesc attribute: <!– The description is on the same page as the image –> <img src=”https://dwfaisalabad.com/wp-content/uploads/2017/08/DWF.png” alt=”DW.com” width=”100″ height=”100″ longdesc=”#w3htmlExplained”> <!– The description is in an external page –> <img src=”https://dwfaisalabad.com/wp-content/uploads/2017/08/DWF.png” alt=”DW” width=”100″ height=”100″ longdesc=”w3html.txt”> <!– The description is one of several within an external page –> […]

HTML <img> hspace Attribute

Example An image with a 20 pixels margin on both left and right sides: <p><img src=”smiley.gif” alt=”Smiley face” hspace=”20″> This is some text. This is some text. This is some text.</p> Try it Yourself » Definition and Usage The hspace attribute specifies the whitespace on left and right side of an image. Browser Support Attribute hspace Yes Yes Yes […]

HTML <img> height Attribute

Example An image with a height and width of 42 pixels: <img src=”smiley.gif” alt=”Smiley face” height=”42″ width=”42″> Try it Yourself » The height attribute specifies the height of an image, in pixels. Tip: Always specify both the height and width attributes for images. If height and width are set, the space required for the image is reserved when the page is loaded. […]

HTML <img> ismap Attribute

Example A server-side image-map: <a href=”/action_page.php”> <img src=”dw.gif” alt=”DW” ismap> </a> Try it Yourself » Definition and Usage The ismap attribute is a boolean attribute. When present, it specifies that the image is part of a server-side image-map (an image-map is an image with clickable areas). When clicking on a server-side image-map, the click coordinates are sent to the […]

HTML <img> alt Attribute

Example An image with an alternate text specified: <img src=”smiley.gif” alt=”Smiley face”> Try it Yourself » Definition and Usage The required alt attribute specifies an alternate text for an image, if the image cannot be displayed. The alt attribute provides alternative information for an image if a user for some reason cannot view it (because of slow […]

HTML <img> usemap Attribute

Example An image-map, with clickable areas: <img src=”planets.gif” width=”145″ height=”126″ alt=”Planets” usemap=”#planetmap”> <map name=”planetmap”> <area shape=”rect” coords=”0,0,82,126″ href=”sun.htm” alt=”Sun”> <area shape=”circle” coords=”90,58,3″ href=”mercur.htm” alt=”Mercury”> <area shape=”circle” coords=”124,58,8″ href=”venus.htm” alt=”Venus”> </map> Try it Yourself » Definition and Usage The usemap attribute specifies an image as a client-side image-map (an image-map is an image with clickable areas). The usemap attribute is associated with a <map> element’s name attribute, and creates a relationship between the <img> and the […]

HTML <img> align Attribute

Example Align an image in the middle of a text: <p>This is some text. <img src=”smiley.gif” alt=”Smiley face” align=”middle”> This is some text.</p> Try it Yourself » Definition and Usage The align attribute specifies the alignment of an image according to the surrounding element. The <img> element is an inline element (it does not insert a new line on a […]

HTML <iframe> longdesc Attribute

Example Point to a page with a long description of the content of the <iframe>: <iframe src=”https://dwfaisalabad.com” width=”500″ height=”300″ longdesc=”DW.txt”> </iframe> Try it Yourself » Definition and Usage The <iframe> longdesc attribute is not supported in HTML5. The longdesc attribute specifies a URL to a page that contains a long description of the content of […]

HTML <iframe> srcdoc Attribute

Example An <iframe> with a srcdoc attribute: <iframe srcdoc=”<p>Hello world!</p>” src=”demo_iframe_srcdoc.htm”></iframe> Try it Yourself » Definition and Usage The srcdoc attribute specifies the HTML content of the page to show in the inline frame. Tip: This attribute is expected to be used together with the sandbox and seamless attributes. If a browser supports the srcdoc attribute, it […]

HTML <iframe> src Attribute

Example An <iframe> in its simplest use: <iframe src=”https://dwfaisalabad.com”></iframe> Try it Yourself » Definition and Usage The src attribute specifies the address of the document to embed in the <iframe>. Browser Support Attribute src Yes Yes Yes Yes Yes Differences Between HTML 4.01 and HTML5 NONE. Syntax <iframe src=”URL“> Attribute Values Value Description URL Specifies the […]