HTML DOM Bold Object

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

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

HTML5 Introduction

What is New in HTML5? The DOCTYPE declaration for HTML5 is very simple: <!DOCTYPE html> The character encoding (charset) declaration is also very simple: <meta charset=”UTF-8″> HTML5 Example: <!DOCTYPE html> <html> <head> <meta charset=”UTF-8″> <title>Title of the document</title> </head><body> Content of the document…… </body></html> Try it Yourself » The default character encoding in HTML5 is UTF-8. New HTML5 Elements […]

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 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 <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 <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 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 Superscript Object

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

TML <sub> Tag

Example Subscript text: <p>This text contains <sub>subscript</sub> text.</p> Try it Yourself » Definition and Usage The <sub> tag defines subscript text. Subscript text appears half a character below the normal line, and is sometimes rendered in a smaller font. Subscript text can be used for chemical formulas, like H2O. Tip: Use the <sup> tag to define superscripted text.

HTML <object> Attributes

HTML <object> align Attribute A right-aligned <object>: <object width=”200″ height=”200″ data=”helloworld.swf” align=”right”></object> Try it Yourself » Definition and Usage The align attribute specifies the alignment of an <object> element according to the surrounding element. The <object> element is an inline element (it does not insert a new line on a page), meaning that text and other elements can wrap around it. […]

HTML <noframes> Tag

Not Supported in HTML5 Example A three-framed page, with a <noframes> tag: <html> <frameset cols=”25%,50%,25%”> <frame src=”frame_a.htm”> <frame src=”frame_b.htm”> <frame src=”frame_c.htm”> <noframes>Sorry, your browser does not handle frames!</noframes> </frameset> </html> Try it Yourself » Definition and Usage The <noframes> tag is not supported in HTML5. The <noframes> tag is a fallback tag for browsers that do not support frames. […]

HTML <tbody> Attributres

HTML <tbody> align Attribute Right-align the content inside the <tbody> element: <table> <thead> <tr> <th>Month</th> <th>Savings</th> </tr> </thead> <tbody align=”right”> <tr> <td>January</td> <td>$100</td> </tr> <tr> <td>February</td> <td>$80</td> </tr> </tbody> </table> Try it Yourself » Definition and Usage The align attribute specifies the horizontal alignment of the content inside the <tbody> element. HTML <tbody> char Attribute Align the content inside the […]

HTML <meter> Tag

Example Use the meter element to measure data within a given range (a gauge): <meter value=”2″ min=”0″ max=”10″>2 out of 10</meter><br> <meter value=”0.6″>60%</meter> Try it Yourself » Definition and Usage The <meter> tag defines a scalar measurement within a known range, or a fractional value. This is also known as a gauge. Examples: Disk usage, the relevance of a […]

HTML <meter> Attributes

HTML <meter> form Attribute Example A <meter> element located outside a form (but still a part of the form): <form action=”/action_page.php” method=”get” id=”form1″> First name: <input type=”text” name=”fname”><br> <input type=”submit” value=”Submit”> </form><meter form=”form1″ name=”x1″ min=”0″ low=”40″ high=”90″ max=”100″ value=”95″></meter> Try it Yourself » Definition and Usage The form attribute specifies one or more forms the <meter> element belongs to. HTML <meter> high Attribute Example A gauge with a current value and min, max, high, […]

HTML <main> Tag

Example <main> <h1>Web Browsers</h1> <p>Google Chrome, Firefox, and Internet Explorer are the most used browsers today.</p><article> <h1>Google Chrome</h1> <p>Google Chrome is a free, open-source web browser developed by Google, released in 2008.</p> </article><article> <h1>Internet Explorer</h1> <p>Internet Explorer is a free web browser from Microsoft, released in 1995.</p> </article> <article> <h1>Mozilla Firefox</h1> <p>Firefox is a free, […]