HTML - attributes - l....

revision:


Content

"label" attribute : specifies the title of the text track "lang" attribute: specifies the language of an element's content "list" attribute : refers to datalist elements "loop" attribute : a boolean attribute to start a video over and over "low" attribute : specifies the low value in a range


"label" attribute : specifies the title of the text track

top

The title of the text track is used by the browser when listing available text tracks. The label attribute can be used on the <track> element, as well as on the ><option> and ><optgroup> elements.

syntax

<track src=" " kind="" srclang=" " label=" ">

some examples

example

no video available

codes:

                    <video width="320" height="240" controls>
                        <source src="forrest_gump.mp4" type="video/mp4">
                        <source src="forrest_gump.ogg" type="video/ogg">
                        <track src="subtitles_en.vtt" kind="subtitles" srclang="en" label="English">
                        <track src="subtitles_no.vtt" kind="subtitles" srclang="no" label="Norwegian">
                    </video>
                

example

codes:

                    <form style="margin-left:5vw;" name="Fav_Sport" >
                        <label>Favorite sports </label>
                        <select name="favoritesports" id="favoritesports">
                            <optgroup label="Sports">
                                <option label="Soccer">Soccer</option>
                                <option label="Hockey">Hockey</option>
                                <option label="Tennis">Tennis</option>
                                <option label="Golf">Golf</option>
                            </optgroup>
                        </select>
                    </form>
                

"lang" attribute: specifies the language of an element's content

top

The attribute contains a single “language tag” in the format defined in Tags for Identifying Languages (BCP47). The lang attribute is a global attribute, and can be used on any HTML element.

The default value of lang is unknown, therefore it is recommended to always specify this attribute with the appropriate value. Usage of lang attribute helps the browser to display the text in the desired language.

syntax

<element lang="language-code "></element>

If the attribute value is the empty string (lang=""), the language is set to unknown; if the language tag is not valid according to BCP47, it is set to invalid. To ensure your page's content is pronounced correctly for screen reader users, use a valid language code in the lang attribute of the <html> element. E.g. <html lang="en">

some examples

example

Ceci est un paragraphe.

This paragraph is English, but the language is not specifically defined.

This paragraph is defined as British English.

codes:

                    <p class="spec" lang="fr">Ceci est un paragraphe.</p>
                    <p class="spec">This paragraph is English, but the language is not specifically defined.</p>
                    <p class="spec" lang="en-GB">This paragraph is defined as British English.</p>
                

example

I am a heading - Eine Überschrift

codes:

                    <h4>I am a heading - <span lang="de-DE">Eine Überschrift</span></h4>                          
                

"list" attribute : refers to datalist elements

top

A <datalist> element contains pre-defined options for an <input> element. The list attribute can be used on the <input> element.

syntax

<input list="name">

name is a string that will work as "id" and will be used to link the <input> element with the <datalist> element.

some examples

example

codes:

                    <form style="margin-left:3vw;" action="/action_page.php" method="get">
                        <label for="browser">Choose your browser from the list:</label>
                        <input list="browsers" name="browser" id="browser">
                        <datalist id="browsers">
                            <option value="Edge">
                            <option value="Firefox">
                            <option value="Chrome">
                            <option value="Opera">
                            <option value="Safari">
                        </datalist>
                        <input type="submit">
                    </form>
                

example

codes:

                    <input style="margin-left:3vw;" type="text" list="numbers" />
                    <input type="range" min="0" max="100" list="numbers" />
                    <input type="number" min="0" max="100" list="numbers" />
                    <datalist id="numbers">
                        <option>10</option> 
                        <option label="30">30</option> 
                        <option label="midpoint">50</option> 
                        <option>70</option>
                        <option>90</option> 
                    </datalist>

                

"loop" attribute : a boolean attribute to start a video over and over

top

When present, it specifies that the video will start over again, every time it is finished.

Applicable: <audio>, <video>, <marquee>, <bgsound>.

syntax

<video loop></video>

<audio loop></video>

some examples

example

codes:

                    <video style="margin-left:3vw;" width="320" height="240" controls loop>
                        <source src="../pics/Wuzhen-20-10_02.mp4" type="video/mp4">
                        Your browser does not support the video tag.
                    </video>
                

example

Click on the play button to play a sound:

codes:

                    <p class="spec">Click on the play button to play a sound:</p>
                    <audio style="margin-left:3vw;"controls loop>
                    <source src="../pics/horse.wav" type="audio/wav">
                    Your browser does not support the audio element.
                    </audio>
                

"low" attribute : specifies the low value in a range

top

It specifies the range where the gauge's value is considered to be a low value. The low attribute value must be greater than the "min attribute" value, and it also must be less than the "high" and "max attribute" values. The low attribute can be used on the <meter> element.

syntax

<meter low="number"></meter>

Attribute values: it contains a floating point value and used to specify the low value of a gauge. If unspecified, or if less than the minimum value, the low value is equal to the minimum value.

some examples

example

codes:

                    <p class="spec"><label for="anna">Anna's score:
                    <meter id="anna" min="0" low="40" high="90" max="100" value="95"></meter></p>
                        
                    <p class="spec"><label for="peter">Peter's score:</label>
                    <meter id="peter" min="0" low="40" high="90" max="100" value="65"></meter></p>
                            
                    <p class="spec"><label for="linda">Linda's score:</label>
                    <meter id="linda" min="0" low="40" high="90" max="100" value="35"></meter></p>                 
                

example

Sachin's score: 5 out of 10

Laxman's score: 50% from 100%

codes:

                    <p class="spec">Sachin's score:
                        <meter value="2" low="3" min="0"  max="10" high="6">5 out of 10</meter></p>
                    <p class="spec">Laxman's score:
                        <meter value="0.5" low="0.3" max="1.0" min="0" high="0.6">50% from 100%</meter></p>