HTML DOM Fieldset Object

Fieldset Object The Fieldset object represents an HTML <fieldset> element. Access a Fieldset Object You can access a <fieldset> element by using getElementById(): Example var x = document.getElementById(“myFieldset”); Try it Yourself » Tip: You can also access a Fieldset object by searching through the elements collection of a form. Create a Fieldset Object You can create a <fieldset> element […]

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 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 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 <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 <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 DOM Map Object

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

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

HTML <i> Tag

Example <p>He named his car <i>The lightning</i>, because it was very fast.</p> Try it Yourself » Definition and Usage The <i> tag defines a part of text in an alternate voice or mood. The content of the <i> tag is usually displayed in italic. The <i> tag can be used to indicate a technical term, a […]

HTML <html> Tag

Example A simple HTML5 document: <!DOCTYPE HTML> <html> <head> <title>Title of the document</title> </head><body> The content of the document…… </body></html> Try it Yourself » Definition and Usage The <html> tag tells the browser that this is an HTML document. The <html> tag represents the root of an HTML document. The <html> tag is the container for […]

HTML <legend> Tag

Example Group related elements in a form: <form> <fieldset> <legend>Personalia:</legend> Name: <input type=”text” size=”30″><br> Email: <input type=”text” size=”30″><br> Date of birth: <input type=”text” size=”10″> </fieldset> </form> Try it Yourself » Definition and Usage The <legend> tag defines a caption for the <fieldset> element. Browser Support Element <legend> Yes Yes Yes Yes Yes Differences Between HTML 4.01 and HTML5 The “align” attribute is not supported in HTML5. […]

HTML <th> rowspan Attribute

Example An HTML table with a header cell that spans three rows: <table> <tr> <th>Month</th> <th>Savings</th> <th rowspan=”3″>Savings for holiday!</th> </tr> <tr> <td>January</td> <td>$100</td> </tr> <tr> <td>February</td> <td>$80</td> </tr> </table> Try it Yourself » More “Try it Yourself” examples below. Definition and Usage The rowspan attribute defines the number of rows a header cell should span. […]

HTML <thead> valign Attribute

Example Vertical align the content inside the <thead> element to the bottom: <table> <thead valign=”bottom”> <tr> <th>Month</th> <th>Savings</th> </tr> </thead> <tr> <td>January</td> <td>$100</td> </tr> <tr> <td>February</td> <td>$80</td> </tr> </table> Try it Yourself » Definition and Usage The <thead> valign attribute is not supported in HTML5. Use CSS instead. The valign attribute specifies the vertical alignment of […]

HTML <thead> align Attribute

Example Left-align the content inside the <thead> element: <table> <thead align=”left”> <tr> <th>Month</th> <th>Savings</th> </tr> </thead> <tr> <td>January</td> <td>$100</td> </tr> <tr> <td>February</td> <td>$80</td> </tr> </table> Try it Yourself » Definition and Usage The align attribute specifies the horizontal alignment of the content inside the <thead> element. Browser Support Attribute align Yes Yes Yes Yes Yes Note: IE […]

HTML <tbody> Tag

An HTML table with a <thead>, <tbody>, and a <tfoot> element: <table> <thead> <tr> <th>Month</th> <th>Savings</th> </tr> </thead> <tbody> <tr> <td>January</td> <td>$100</td> </tr> <tr> <td>February</td> <td>$80</td> </tr> </tbody> <tfoot> <tr> <td>Sum</td> <td>$180</td> </tr> </tfoot> </table> Try it Yourself » Definition and Usage The <tbody> tag is used to group the body content in an HTML […]

HTML <thead> Tag

Example An HTML table with a <thead>, <tbody>, and a <tfoot> element: <table> <thead> <tr> <th>Month</th> <th>Savings</th> </tr> </thead> <tbody> <tr> <td>January</td> <td>$100</td> </tr> <tr> <td>February</td> <td>$80</td> </tr> </tbody> <tfoot> <tr> <td>Sum</td> <td>$180</td> </tr> </tfoot> </table> Try it Yourself » Definition and Usage The <thead> tag is used to group header content in an HTML […]