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 […]

HTML <iframe> scrolling Attribute

Example An <iframe> with scrollbars: <iframe src=”/default.asp” width=”300″ height=”300″ scrolling=”yes”> </iframe> Try it Yourself » Definition and Usage The <iframe> scrolling attribute is not supported in HTML5. Use CSS instead. The scrolling attribute specifies whether or not to display scrollbars in an <iframe>. Normally, scrollbars appear in an <iframe> when the content is larger than the <iframe>. Browser Support […]

HTML <iframe> sandbox Attribute

Example An <iframe> with extra restrictions: <iframe src=”sandbox.htm” sandbox></iframe> Try it Yourself » More “Try it Yourself” examples below. Definition and Usage The sandbox attribute enables an extra set of restrictions for the content in the iframe. When the sandbox attribute is present, and it will: treat the content as being from a unique origin block form […]

HTML <iframe> name Attribute

Example An <iframe> that act as a target for a link: <iframe src=”demo_iframe.htm” name=”iframe_a”></iframe> <a href=”https://dwfaisalabad.com” target=”iframe_a”> Visit DW </a> Try it Yourself » Definition and Usage The name attribute specifies a name for the <iframe>. This name attribute can be used to reference the element in a JavaScript, or as the value of the target attribute of an […]

HTML <iframe> marginheight and marginwidth Attribute

Example An <iframe> with a top and bottom margin of 50 pixels: <iframe src=”demo_iframe.htm” marginheight=”50″ marginwidth=”50″> </iframe> Try it Yourself » Definition and Usage The <iframe> marginheight and marginwidth attribute is not supported in HTML5. Use CSS instead. The marginheight and marginwidth attribute specifies the top and bottom margins  and left and right of the content of an <iframe> […]