最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

HTML5中一些酷炫又有趣的新特性代碼整理匯總

 更新時(shí)間:2023年02月25日 16:04:54   投稿:yin  
HTML5技術(shù)結(jié)合了HTML4.01的相關(guān)標(biāo)準(zhǔn)并革新,符合現(xiàn)代網(wǎng)絡(luò)發(fā)展要求,在2008年正式發(fā)布。HTML5并非僅僅用來(lái)表示W(wǎng)eb內(nèi)容,它將?Web帶入一個(gè)成熟的應(yīng)用平臺(tái),在HTML5平臺(tái)上,視頻、音頻、圖象、動(dòng)畫,以及同電腦的交互都被標(biāo)準(zhǔn)化。

HTML5 是 HyperText Markup Language 5 的縮寫,HTML5技術(shù)結(jié)合了HTML4.01的相關(guān)標(biāo)準(zhǔn)并革新,符合現(xiàn)代網(wǎng)絡(luò)發(fā)展要求,在2008年正式發(fā)布。HTML5 由不同的技術(shù)構(gòu)成,其在互聯(lián)網(wǎng)中得到了非常廣泛的應(yīng)用,提供更多增強(qiáng)網(wǎng)絡(luò)應(yīng)用的標(biāo)準(zhǔn)機(jī)。與傳統(tǒng)的技術(shù)相比,HTML5 的語(yǔ)法特征更加明顯,并且結(jié)合了SVG的內(nèi)容。

HTML5并非僅僅用來(lái)表示W(wǎng)eb內(nèi)容,它將 Web帶入一個(gè)成熟的應(yīng)用平臺(tái),在HTML5平臺(tái)上,視頻、音頻、圖象、動(dòng)畫,以及同電腦的交互都被標(biāo)準(zhǔn)化。

HTML5自初始版本(2008 年 1 月)以來(lái),我們一直在使用它的幾個(gè)功能。再次查看HTML5 功能列表。發(fā)現(xiàn)一些功能過(guò)去用得不多,但現(xiàn)在發(fā)現(xiàn)它們很有用。

一、詳情標(biāo)簽

<details>標(biāo)簽向用戶提供按需詳細(xì)信息。如果您需要按需向用戶顯示內(nèi)容,請(qǐng)使用此標(biāo)簽。默認(rèn)情況下,小部件是關(guān)閉的。打開時(shí),它會(huì)展開并顯示其中的內(nèi)容。

<summary>標(biāo)簽用于<details>為它指定一個(gè)可見(jiàn)的標(biāo)題。

<details>
     <summary>Click Here to get the user details</summary>
            <table>
                <tr>
                    <th>#</th>
                    <th>Name</th>
                    <th>Location</th>
                    <th>Job</th>
                </tr>
                <tr>
                    <td>1</td>
                    <td>Adam</td>
                    <td>Huston</td>
                    <td>UI/UX</td>
                </tr>
                <tr>
                    <td>2</td>
                    <td>Bob</td>
                    <td>London</td>
                    <td>Machine Learning</td>
                </tr>
                <tr>
                    <td>3</td>
                    <td>Jack</td>
                    <td>Australia</td>
                    <td>UI Designer</td>
                </tr>
                <tr>
                    <td>4</td>
                    <td>Tapas</td>
                    <td>India</td>
                    <td>Blogger</td>
                </tr>
            </table>
        </details>

二、內(nèi)容可編輯

contenteditable是可以在元素上設(shè)置以使內(nèi)容可編輯的屬性。它適用于 DIV、P、UL 等元素。您必須指定它,例如,<element contenteditable="true|false">。

注意: 當(dāng)contenteditable元素上沒(méi)有設(shè)置屬性時(shí),它將從其父元素繼承。

<h2> Shoppping List(Content Editable) </h2>
 <ul class="content-editable" contenteditable="true">
     <li> 1. Milk </li>
     <li> 2. Bread </li>
     <li> 3. Honey </li>
</ul>

三、地圖

<map>標(biāo)簽有助于定義圖像映射。圖像映射是其中包含一個(gè)或多個(gè)可點(diǎn)擊區(qū)域的圖像。地圖標(biāo)簽帶有一個(gè)<area>標(biāo)簽來(lái)確定可點(diǎn)擊區(qū)域??牲c(diǎn)擊區(qū)域可以是這些形狀、矩形、圓形或多邊形區(qū)域之一。如果您不指定任何形狀,它會(huì)考慮整個(gè)圖像。

<div>
    <img src="circus.jpg" width="500" height="500" alt="Circus" usemap="#circusmap">

    <map name="circusmap">
        <area shape="rect" coords="67,114,207,254" href="elephant.htm" rel="external nofollow" >
        <area shape="rect" coords="222,141,318, 256" href="lion.htm" rel="external nofollow" >
        <area shape="rect" coords="343,111,455, 267" href="horse.htm" rel="external nofollow" >
        <area shape="rect" coords="35,328,143,500" href="clown.htm" rel="external nofollow"  rel="external nofollow" >
        <area shape="circle" coords="426,409,100" href="clown.htm" rel="external nofollow"  rel="external nofollow" >
    </map>
 </div>

四、標(biāo)記內(nèi)容

使用<mark>標(biāo)簽突出顯示任何文本內(nèi)容。

<p> 你知道嗎,你可以僅使用 HTML 標(biāo)簽 <mark>"突出顯示有趣的東西"</mark></p>

使用 css 更改高亮顏色

mark {
  background-color: green;
  color: #FFFFFF;
}

五、data-* 屬性

這些data-*屬性用于存儲(chǔ)頁(yè)面或應(yīng)用程序私有的自定義數(shù)據(jù)。存儲(chǔ)的數(shù)據(jù)可用于 JavaScript 代碼以創(chuàng)建進(jìn)一步的用戶體驗(yàn)。

data-* 屬性由兩部分組成:

屬性名稱不應(yīng)包含任何大寫字母,并且必須在前綴“data-”之后至少長(zhǎng)一個(gè)字符
屬性值可以是任何字符串

<h2> Know data attribute </h2>
 <div 
       class="data-attribute" 
       id="data-attr" 
       data-custom-attr="You are just Awesome!"> 
   I have a hidden secret!
  </div>

 <button onclick="reveal()">Reveal</button>
 <p id="msg"></p>
<script>
function reveal() {
   let dataDiv = document.getElementById('data-attr');
   let value = dataDiv.dataset['customAttr'];
   //使用getAttribute()它們的完整 HTML 名稱(即 data-custom-attr),
   //但標(biāo)準(zhǔn)定義了一種更簡(jiǎn)單的方法:使用dataset屬性。
   document.getElementById('msg').innerHTML = `<mark>${value}</mark>`;
}
</script>

六、輸出標(biāo)簽

<output>標(biāo)簽表示的運(yùn)算的結(jié)果。通常,此元素定義將用于顯示某些計(jì)算的文本輸出的區(qū)域。

<form oninput="x.value=parseInt(a.value) * parseInt(b.value)">
   <input type="number" id="a" value="0">
   * <input type="number" id="b" value="0">
   = <output name="x" for="a b"></output>
</form>

七、數(shù)據(jù)列表

<datalist>標(biāo)簽指定了一個(gè)預(yù)定義選項(xiàng)列表,并允許用戶向其中添加更多選項(xiàng)。它提供了一項(xiàng)autocomplete功能,允許您通過(guò)預(yù)先輸入獲得所需的選項(xiàng)。

<form action="" method="get">
    <label for="fruit">Choose your fruit from the list:</label>
    <input list="fruits" name="fruit" id="fruit">
        <datalist id="fruits">
           <option value="Apple">
           <option value="Orange">
           <option value="Banana">
           <option value="Mango">
           <option value="Avacado">
        </datalist>
     <input type="submit">
 </form>  

八、范圍(滑塊)

range是給定滑塊類型范圍選擇器的輸入類型。

<form method="post">
    <input 
         type="range" 
         name="range" 
         min="0" 
         max="100" 
         step="1" 
         value=""
         onchange="changeValue(event)"/>
 </form>
 <div class="range">
      <output id="output" name="result">  </output>
 </div>

九、Meter

使用<meter>標(biāo)簽測(cè)量給定范圍內(nèi)的數(shù)據(jù)。

<label for="home">/home/atapas</label>
<meter id="home" value="4" min="0" max="10">2 out of 10</meter><br>

<label for="root">/root</label>
<meter id="root" value="0.6">60%</meter><br>

提示不要將<meter>標(biāo)簽用于進(jìn)度指示器類型的用戶體驗(yàn)。我們有來(lái)自 HTML5的<Progress>標(biāo)簽。

<label for="file">Downloading progress:</label>
<progress id="file" value="32" max="100"> 32% </progress>

十、Inputs

這部分是我們最熟悉的輸入類型的用法,如文本、密碼等。輸入類型的特殊用法很少

必需的

將輸入字段標(biāo)記為必填字段。

<input type="text" id="username1" name="username" required>

自動(dòng)對(duì)焦

通過(guò)將光標(biāo)放在輸入元素上自動(dòng)提供焦點(diǎn)。

<input type="text" id="username2" name="username"autofocus>

使用正則表達(dá)式驗(yàn)證

您可以使用正則表達(dá)式指定模式來(lái)驗(yàn)證輸入。

<input type="password" 
            name="password" 
            id="password" 
            placeholder="6-20 chars, at least 1 digit, 1 uppercase and one lowercase letter" 
            pattern="^(?=.*\d)(?=.*[a-z])(?=.*[A-Z]).{6,20}$">

顏色選擇器

一個(gè)簡(jiǎn)單的顏色選擇器。

<input type="color" onchange="showColor(event)">
<p id="colorMe">Color Me!</p>

到此這篇關(guān)于HTML5中一些酷炫又有趣的新特性代碼整理匯總的文章就介紹到這了,更多相關(guān)HTML5新特性代碼內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

最新評(píng)論

西安市| 望奎县| 安平县| 甘泉县| 灵山县| 乌拉特前旗| 易门县| 平阳县| 山阳县| 吉木萨尔县| 桐乡市| 鞍山市| 徐汇区| 平乐县| 北碚区| 鄯善县| 三穗县| 云林县| 额济纳旗| 泰顺县| 河西区| 中超| 宜黄县| 资阳市| 岳普湖县| 南汇区| 景德镇市| 六枝特区| 阳春市| 丹巴县| 当阳市| 临湘市| 巴南区| 平泉县| 镇坪县| 宜良县| 溧水县| 鲁甸县| 台安县| 金川县| 永和县|