久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

對(duì)多個(gè) HTML 標(biāo)簽使用相同的 ID?

Using same ID for multiple HTML tags?(對(duì)多個(gè) HTML 標(biāo)簽使用相同的 ID?)
本文介紹了對(duì)多個(gè) HTML 標(biāo)簽使用相同的 ID?的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

可能重復(fù):
多個(gè)具有相同ID的元素響應(yīng)一個(gè) CSS ID 選擇器

下面是我正在測(cè)試的示例代碼,我很困惑.每個(gè)人都說我們可以使用或者我們應(yīng)該每個(gè) id 只使用一次,但我有測(cè)試使用它多次但它給了我正確的輸出.

Below is the example code that I was testing and I got confused. Every one says that we can use or we should use only one time per id, but I have testes using using it multiple times but its giving me the correct output.

我該怎么辦?

在這個(gè)例子中,它有點(diǎn)像我的類

It's kinda working same like class for me in this example

代碼:

<html>
<head>
<style>

#exampleID1 { background-color: blue; } 
#exampleID2 { text-transform: uppercase; } 

</style>
</head>
<body>
<p id="exampleID1">This paragraph has an ID name of "exampleID1" and has a blue CSS defined background.</p>
<p id="exampleID2">This paragraph has an ID name of "exampleID2" and has had its text transformed to uppercase letters.</p>

<address id="exampleID1">

Written by W3Schools.com<br />
<a href="mailto:us@example.org">Email us</a><br />
Address: Box 564, Disneyland<br />
Phone: +12 34 56 78
</address>


<blockquote id="exampleID1">
Here is a long quotation here is a long quotation here is a long quotation here is a long quotation here is a long quotation here is a long quotation here is a long quotation here is a long quotation here is a long quotation.
</blockquote>

</body>
</html>

請(qǐng)查看上面的代碼并回答我為什么我們不應(yīng)該在一個(gè)頁面中使用兩次 id 選擇器而它工作正常.

Please see the above code and answer me that why we should not use id selector two times in a page while its working fine.

推薦答案

一個(gè) id 在一個(gè)頁面中必須是唯一的.如果要描述一組元素,請(qǐng)使用類.

An id must be unique in a page. Use a class if you want to describe a group of elements.

為什么我們不應(yīng)該在一個(gè)頁面中使用 id 選擇器兩次而它工作正常.

why we should not use id selector two times in a page while its working fine.

您犯了一個(gè)錯(cuò)誤,這取決于每個(gè)瀏覽該頁面的瀏覽器來彌補(bǔ)它.你不能確定他們都會(huì).

You are making an error and depending on every browser that will ever view the page to compensate for it. You can't be sure they all will.

這篇關(guān)于對(duì)多個(gè) HTML 標(biāo)簽使用相同的 ID?的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

CSS selector when :target empty(:target 為空時(shí)的 CSS 選擇器)
Does the CSS direct decendant (gt;) not have any value in selectivity?(CSS 直接后代 (gt;) 在選擇性方面沒有任何價(jià)值嗎?)
Using querySelectorAll(). Is the result returned by the method ordered?(使用 querySelectorAll().方法返回的結(jié)果是否有序?)
Safari bug :first-child doesn#39;t update display:block when items are removed with JS(Safari 錯(cuò)誤:當(dāng)使用 JS 刪除項(xiàng)目時(shí),first-child 不更新 display:block)
nth-Child CSS selectors(nth-子 CSS 選擇器)
CSS: Select element only if a later sibling exists(CSS:僅當(dāng)存在較晚的兄弟時(shí)才選擇元素)
主站蜘蛛池模板: 国产一级片免费在线观看 | 久久精品青青大伊人av | 成人av一区| 国产精选一区 | 久久伊人精品 | 日韩资源 | 天天爽夜夜骑 | 国产精品久久久久久久久久久久久 | 精品一区国产 | 91影院 | 亚洲欧洲精品在线 | 在线欧美小视频 | 福利视频大全 | 97狠狠干 | 日韩精品在线一区 | 亚洲毛片网站 | 久久99精品国产99久久6男男 | 色婷婷综合久久久中字幕精品久久 | 91精品麻豆日日躁夜夜躁 | 噜噜噜噜狠狠狠7777视频 | 国产色视频网站 | 麻豆精品国产91久久久久久 | 高清一区二区视频 | 国产精品久久久久久久久久免费看 | 亚洲精品久久久久中文字幕欢迎你 | 亚洲 欧美 日韩 在线 | 成人在线视频网站 | 久久久91精品国产一区二区三区 | 中文字幕乱码亚洲精品一区 | 国产精品久久亚洲 | 一区二区三区电影在线观看 | 黄色在线免费观看 | 天天综合国产 | 瑟瑟视频在线看 | 国产日韩在线观看一区 | www.天天操.com| 日韩精品一区二区三区视频播放 | 日韩在线精品视频 | 欧美精品在线一区 | 亚洲国产一区视频 | 国产日韩欧美一区二区 |