The HTML DOM Document Object

When an HTML document is loaded into a web browser, it becomes a document object. The document object is the root node of the HTML document. Document Object Properties and Methods The following properties and methods can be used on HTML documents: Property / Method Description activeElement Returns the currently focused element in the document addEventListener() […]

The HTML DOM Attribute Object

The Attr Object In the HTML DOM, the Attr object represents an HTML attribute. An HTML attribute always belongs to an HTML element. The NamedNodeMap Object In the HTML DOM, the NamedNodeMap object represents an unordered collection of an elements attribute nodes. Nodes in a NamedNodeMap can be accessed by name or by index (number). Properties and Methods Property […]

HTML YouTube Videos

The easiest way to play videos in HTML, is to use YouTube. Struggling with Video Formats? Earlier in this tutorial, you have seen that you might have to convert your videos to different formats to make them play in all browsers. Converting videos to different formats can be difficult and time-consuming. An easier solution is […]

HTML Multimedia

Multimedia on the web is sound, music, videos, movies, and animations. What is Multimedia? Multimedia comes in many different formats. It can be almost anything you can hear or see. Examples: Images, music, sound, videos, records, films, animations, and more. Web pages often contain multimedia elements of different types and formats. In this chapter you will learn […]

HTML <acronym> Tag

Not Supported in HTML5 Example An acronym is marked up as follows: Can I get this <acronym title=”as soon as possible”>ASAP</acronym>? Try it Yourself » Definition and Usage The <acronym> tag is not supported in HTML5. Use the <abbr> tag instead. The <acronym> tag defines an acronym. An acronym must spell out another word. For example: NASA, ASAP, GUI. […]

HTML <select> Attributes

HTML <select> autofocus Attribute A drop-down list with autofocus: <select autofocus> <option value=”volvo”>Volvo</option> <option value=”saab”>Saab</option> <option value=”opel”>Opel</option> <option value=”audi”>Audi</option> </select> Try it Yourself » Definition and Usage The autofocus attribute is a boolean attribute. When present, it specifies that the drop-down list should automatically get focus when the page loads. HTML <select> disabled Attribute A disabled drop-down list: <select disabled> <option value=”volvo”>Volvo</option> <option value=”saab”>Saab</option> <option value=”mercedes”>Mercedes</option> <option value=”audi”>Audi</option> </select> […]

HTML <small> Tag

Example Define a smaller text: <p>DW Faisalabad</p> <p><small> – the world’s largest web development site.</small></p> Try it Yourself » Definition and Usage The <small> tag defines smaller text (and other side comments). Browser Support Element <small> Yes Yes Yes Yes Yes Differences Between HTML 4.01 and HTML5 NONE.   Related Pages HTML tutorial: HTML Text Formatting […]

HTML DOM Source Object

Source Object  The Source Object is new in HTML5. The Source object represents an HTML <source> element. Access a Source Object You can access a <source> element by using getElementById(): Example var x = document.getElementById(“mySource”); Try it Yourself » Create a Source Object You can create a <source> element by using the document.createElement() method: Example var x […]

HTML <source> Attributes

HTML <source> src Attribute An audio player with two source files. The browser should choose which file (if any) it has support for: <audio controls> <source src=”horse.mp3″ type=”audio/mpeg”> Your browser does not support the audio element. </audio> Try it Yourself » Definition and Usage The src attribute specifies the URL of the media file to play. This attribute is required […]

HTML DOM S Object

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

HTML <rp> Tag

Example A ruby annotation:www. <ruby> 漢 <rt><rp>(</rp>ㄏㄢˋ<rp>)</rp></rt> </ruby> Try it Yourself » Definition and Usage The <rp> tag can be used to provide parentheses around a ruby text, to be shown by browsers that do not support ruby annotations. Use the <rp> tag together with the <ruby> and the <rt> tags: The <ruby> element consists of one or more characters […]

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

Example A ruby annotation: <ruby> 漢 <rt> ㄏㄢˋ </rt> </ruby> Try it Yourself » Definition and Usage The <ruby> tag specifies a ruby annotation. A ruby annotation is a small extra text, attached to the main text to indicate the pronunciation or meaning of the corresponding characters. This kind of annotation is often used in Japanese publications. Use […]

HTML <span> Tag

Example A <span> element used to color a part of a text: <p>My mother has <span style=”color:blue”>blue</span> eyes.</p> Try it Yourself » Definition and Usage The <span> tag is used to group inline-elements in a document. The <span> tag provides no visual change by itself. The <span> tag provides a way to add a hook to a part […]

HTML DOM Progress Object

Progress Object  The Progress Object is new in HTML5. The Progress object represents an HTML <progress> element. The <progress> element represents the progress of a task. Access a Progress Object You can access a <progress> element by using getElementById(): Example var x = document.getElementById(“myProgress”); Try it Yourself » Create a Progress Object You can create a […]

HTML <pre> Tag

Example Preformatted text: <pre> Text in a pre element is displayed in a fixed-width font, and it preserves both      spaces and line breaks </pre> Try it Yourself » Definition and Usage The <pre> tag defines preformatted text. Text in a <pre> element is displayed in a fixed-width font (usually Courier), and it preserves both spaces […]

HTML DOM Pre Object

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

HTML DOM Strong Object

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

HTML <picture> Tag

Example How to use the <picture> tag: <picture> <source media=”(min-width: 650px)” srcset=”img_pink_flowers.jpg”> <source media=”(min-width: 465px)” srcset=”img_white_flower.jpg”> <img src=”img_orange_flowers.jpg” alt=”Flowers” style=”width:auto;”> </picture> Try it Yourself » Definition and Usage The <picture> tag gives web developers more flexibility in specifying image resources. The most common use of the <picture> element will be for art direction in responsive designs. Instead of having one image that […]

HTML DOM Parameter Object

Parameter Object The Parameter object represents an HTML <param> element. The <param> element is used to define parameters for plugins embedded with an <object> element. Access a Parameter Object You can access a <param> element by using getElementById(): Example var x = document.getElementById(“myParam”); Try it Yourself » Create a Parameter Object You can create a <param> […]