HTML DOM Samp Object

Samp Object The Samp object represents an HTML <samp> element. Access a Samp Object You can access a <samp> element by using getElementById(): Example var x = document.getElementById(“mySamp”); Try it Yourself » Create a Samp Object You can create a <samp> element by using the document.createElement() method: Example var x = document.createElement(“SAMP”); Try it Yourself » Standard […]

HTML <rt> Tag

Example A ruby annotation: <ruby> 漢 <rt> ㄏㄢˋ </rt> </ruby> Try it Yourself » Definition and Usage The <rt> tag defines an explanation or pronunciation of characters (for East Asian typography) in a ruby annotation. Use the <rt> tag together with the <ruby> and the <rp> tags: The <ruby> element consists of one or more characters that needs an explanation/pronunciation, and an […]

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 <tt> Tag

Not Supported in HTML5 Example Define teletype text: <p><tt>Teletype text</tt></p> Try it Yourself » Definition and Usage The <tt> tag is not supported in HTML5. If <tt> was used for marking up keyboard input, consider the <kbd> element; for variables, consider the <var> element; for computer code, consider the <code> element; and for computer output, consider the <samp> element, or use CSS instead. […]

HTML DOM DFN Object

DFN Object The DFN object represents an HTML <dfn> element. Access a DFN Object You can access a <dfn> element by using getElementById(): Example var x = document.getElementById(“myDFN”); Try it Yourself » Create a DFN Object You can create a <dfn> element by using the document.createElement() method: Example var x = document.createElement(“DFN”); Try it Yourself » Standard […]

HTML DOM Blockquote Object

Blockquote Object The Blockquote object represents an HTML <blockquote> element. Access a Blockquote Object You can access a <blockquote> element by using getElementById(): Example var x = document.getElementById(“myBlockquote”); Try it Yourself » Create a Blockquote Object You can create a <blockquote> element by using the document.createElement() method: Example var x = document.createElement(“BLOCKQUOTE”); Try it Yourself » Blockquote […]

HTML DOM Bdo Object

Bdo Object The Bdo object represents an HTML <bdo> element. Access a Bdo Object You can access a <bdo> element by using getElementById(): Example var x = document.getElementById(“myBdo”); Try it Yourself » Create a Bdo Object You can create a <bdo> element by using the document.createElement() method: Example var x = document.createElement(“BDO”); Try it Yourself » Bdo […]

HTML <img> Tag

Example How to insert an image: <img src=”smiley.gif” alt=”Smiley face” height=”82″ width=”82″> Try it Yourself » More “Try it Yourself” examples below. Definition and Usage The <img> tag defines an image in an HTML page. The <img> tag has two required attributes: src and alt. Note: Images are not technically inserted into an HTML page, images are linked to HTML […]