久久久久久久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í)才選擇元素)
主站蜘蛛池模板: 99精品视频免费观看 | 一区二区三区四区不卡视频 | 神马久久春色视频 | 久久久久国产精品 | 国产亚洲一区二区三区 | 视频在线一区二区 | 毛片网在线观看 | 国产专区在线 | www..99re| 最近中文字幕第一页 | 久久一级 | 亚洲精品乱码久久久久久9色 | 激情五月婷婷综合 | 一区二区三区欧美 | 99精品欧美一区二区三区 | 免费国产一区二区视频 | 91精品国产综合久久久久久蜜臀 | 久久成人免费 | 成人国产在线观看 | av一级久久 | 美女在线国产 | 亚洲成人a v | 国产欧美日韩一区 | 久草成人 | www久久久| 精品视频999 | 精品亚洲视频在线 | 日韩视频一区在线观看 | 二区av | 欧美中文字幕一区二区三区 | 国产欧美日韩一区 | 日韩免费一区 | 亚洲精品av在线 | 久操伊人 | 久久久久国 | 久久精品亚洲精品国产欧美 | 欧美国产精品一区二区三区 | 中文字幕一区在线观看视频 | 久久久久av | 免费一看一级毛片 | 91原创视频在线观看 |