HTML <th> Tag

Example A simple HTML table with two header cells and two data cells: <table> <tr> <th>Month</th> <th>Savings</th> </tr> <tr> <td>January</td> <td>$100</td> </tr> </table> Try it Yourself » More “Try it Yourself” examples below. Definition and Usage The <th> tag defines a header cell in an HTML table. An HTML table has two kinds of cells: […]

HTML <track> src Attribute

Example A video with two subtitle tracks: <video width=”320″ height=”240″ controls> <source src=”forrest.mp4″ type=”video/mp4″>  <track src=”subtitles_en.vtt” kind=”subtitles” srclang=”en” label=”English”> <track src=”subtitles_no.vtt” kind=”subtitles” srclang=”no” label=”Norwegian”> </video> Definition and Usage The required src attribute specifies the URL of the track file. Browser Support The numbers in the table specify the first browser version that fully supports the attribute. Attribute src 18.0 10.0 31.0 6.0 15.0 Differences Between HTML 4.01 and […]

HTML <track> label Attribute

Example A video with two subtitle tracks, both with a label defined: <video width=”320″ height=”240″ controls> <source src=”forrest_gump.mp4″ type=”video/mp4″>  <track src=”subtitles_en.vtt” kind=”subtitles” srclang=”en” label=”English”> <track src=”subtitles_no.vtt” kind=”subtitles” srclang=”no” label=”Norwegian”> </video> Definition and Usage The label attribute specifies the title of the text track. The title of the text track is used by the browser when listing available text tracks. Browser Support The numbers in the table specify the […]

HTML <track> kind Attribute

Example A video with two subtitle tracks: <video width=”320″ height=”240″ controls> <source src=”forrest.mp4″ type=”video/mp4″> <track src=”subtitles_en.vtt” kind=”subtitles” srclang=”en” label=”English”> <track src=”subtitles_no.vtt” kind=”subtitles” srclang=”no” label=”Norwegian”> </video> Definition and Usage The kind attribute specifies the kind of text track. Browser Support The numbers in the table specify the first browser version that fully supports the attribute. Attribute kind 18.0 10.0 31.0 6.0 15.0 Differences Between HTML 4.01 and HTML5 The […]

HTML <track> default Attribute

Example A video with two subtitle tracks. “English” subtitle is the default: <video width=”320″ height=”240″ controls> <source src=”forrest.mp4″ type=”video/mp4″>  <track src=”subtitles_en.vtt” kind=”subtitles” srclang=”en” label=”English” default> <track src=”subtitles_no.vtt” kind=”subtitles” srclang=”no” label=”Norwegian”> </video> Definition and Usage The default attribute is a boolean attribute. When present, it specifies that the track is to be enabled if the user’s preferences do not indicate that another track would be more appropriate. Note: There must not […]

HTML <track> Tag

Example A video with two subtitle tracks: <video width=”320″ height=”240″ controls> <source src=”forrest.mp4″ type=”video/mp4″>  <track src=”subtitles_en.vtt” kind=”subtitles” srclang=”en” label=”English”> <track src=”subtitles_no.vtt” kind=”subtitles” srclang=”no” label=”Norwegian”> </video> Definition and Usage The <track> tag specifies text tracks for media elements (<audio> and <video>). This element is used to specify subtitles, caption files or other files containing text, that should be visible when the media is playing. Browser Support The numbers in […]

HTML <video> Tag

Example Play a video: <video width=”320″ height=”240″ controls> <source src=”movie.mp4″ type=”video/mp4″> <source src=”movie.ogg” type=”video/ogg”> Your browser does not support the video tag. </video> Try it Yourself » Definition and Usage The <video> tag specifies video, such as a movie clip or other video streams. Currently, there are 3 supported video formats for the <video> element: MP4, WebM, and Ogg: Browser MP4 WebM […]

HTML <video> width Attribute

Example A video player with a specified width and height: <video width=”320″ height=”240″ controls> <source src=”movie.mp4″ type=”video/mp4″> Your browser does not support the video tag. </video> Try it Yourself » Definition and Usage The width attribute specifies the width of a video player, in pixels. Tip: Always specify both the height and width attributes for videos. If height and width are […]

HTML <video> poster Attribute

Example A video player with a poster image: <video controls poster=”/images/w3html5.gif”> <source src=”movie.mp4″ type=”video/mp4″> Your browser does not support the video tag. </video> Try it Yourself » Definition and Usage The poster attribute specifies an image to be shown while the video is downloading, or until the user hits the play button. If this is not included, the […]

HTML <video> muted Attribute

Example A muted video: <video controls muted> <source src=”movie.mp4″ type=”video/mp4″> Your browser does not support the video tag. </video> Try it Yourself » Definition and Usage The muted attribute is a boolean attribute. When present, it specifies that the audio output of the video should be muted. Browser Support The numbers in the table specify the first browser […]

HTML <video> loop Attribute

Example A video that will start over again, every time it is finished: <video controls loop> <source src=”movie.mp4″ type=”video/mp4″> Your browser does not support the video tag. </video> Try it Yourself » Definition and Usage The loop attribute is a boolean attribute. When present, it specifies that the video will start over again, every time it is finished. […]

HTML <video> height Attribute

Example A video player with a specified height and width: <video width=”320″ height=”240″ controls> <source src=”movie.mp4″ type=”video/mp4″> Your browser does not support the video tag. </video> Try it Yourself » Definition and Usage The height attribute specifies the height of a video player, in pixels. Tip: Always specify both the height and width attributes for videos. If height and width are […]

HTML <video> controls Attribute

Example A <video> element with browser default controls: <video controls> <source src=”movie.mp4″ type=”video/mp4″> Your browser does not support the video tag. </video> Try it Yourself » Definition and Usage The controls attribute is a boolean attribute. When present, it specifies that video controls should be displayed. Video controls should include: Play Pause Seeking Volume Fullscreen toggle Captions/Subtitles (when […]

HTML <video> autoplay Attribute

Example A video that will automatically start playing: <video controls autoplay> <source src=”movie.mp4″ type=”video/mp4″> Your browser does not support the video tag. </video> Try it Yourself » Definition and Usage The autoplay attribute is a boolean attribute. When present, the video will automatically start playing as soon as it can do so without stopping. Browser Support The numbers […]

HTML <ul> Tag

Example An unordered HTML list: <ul> <li>Coffee</li> <li>Tea</li> <li>Milk</li> </ul> Try it Yourself » More “Try it Yourself” examples below. Definition and Usage The <ul> tag defines an unordered (bulleted) list. Use the <ul> tag together with the <li> tag to create unordered lists. Browser Support Element <ul> Yes Yes Yes Yes Yes Tips and Notes Tip: Use […]

HTML <dd> Tag

Example A description list, with terms and descriptions: <dl> <dt>Coffee</dt> <dd>Black hot drink</dd> <dt>Milk</dt> <dd>White cold drink</dd> </dl> Try it Yourself » Definition and Usage The <dd> tag is used to describe a term/name in a description list. The <dd> tag is used in conjunction with <dl> (defines a description list) and <dt> (defines terms/names). Inside a <dd> tag […]

HTML <datalist> Tag

Example An <input> element with pre-defined values in a <datalist>: <input list=”browsers”> <datalist id=”browsers”> <option value=”Internet Explorer”> <option value=”Firefox”> <option value=”Chrome”> <option value=”Opera”> <option value=”Safari”> </datalist> Try it Yourself » Definition and Usage The <datalist> tag specifies a list of pre-defined options for an <input> element. The <datalist> tag is used to provide an “autocomplete” feature on <input> elements. Users will see […]

HTML <data> Tag

Example The following example displays product names but also associates each name with a product number: <ul> <li><data value=”21053″>Cherry Tomato</data></li> <li><data value=”21054″>Beef Tomato</data></li> <li><data value=”21055″>Snack Tomato</data></li> </ul> Try it Yourself » Definition and Usage The <data> tag links the given content with a machine-readable translation. This element provides both a machine-readable value for data processors, and a human-readable […]

HTML <col> width Attribute

Example Two <col> elements with a predefined width: <table> <col width=”130″> <col width=”80″> <tr> <th>Month</th> <th>Savings</th> </tr> <tr> <td>January</td> <td>$100</td> </tr> <tr> <td>February</td> <td>$80</td> </tr> </table> Try it Yourself » Definition and Usage The width attribute specifies the width of a <col> element. Normally, a <col> element takes up the space it needs to display the content. […]

HTML <col> span Attribute

Example Here, the first two columns should have a background color of red: <table> <colgroup> <col span=”2″ style=”background-color:red”> <col style=”background-color:yellow”> </colgroup> <tr> <th>ISBN</th> <th>Title</th> <th>Price</th> </tr> <tr> <td>3476896</td> <td>My first HTML</td> <td>$53</td> </tr> </table> Try it Yourself » Definition and Usage The span attribute defines the number of columns a <col> element should span. Browser Support Attribute span […]