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

對多個 HTML 標簽使用相同的 ID?

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

問題描述

可能重復:
多個具有相同ID的元素響應一個 CSS ID 選擇器

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

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.

我該怎么辦?

在這個例子中,它有點像我的類

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>

請查看上面的代碼并回答我為什么我們不應該在一個頁面中使用兩次 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.

推薦答案

一個 id 在一個頁面中必須是唯一的.如果要描述一組元素,請使用類.

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

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

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

您犯了一個錯誤,這取決于每個瀏覽該頁面的瀏覽器來彌補它.你不能確定他們都會.

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.

這篇關于對多個 HTML 標簽使用相同的 ID?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

相關文檔推薦

CSS selector when :target empty(:target 為空時的 CSS 選擇器)
Does the CSS direct decendant (gt;) not have any value in selectivity?(CSS 直接后代 (gt;) 在選擇性方面沒有任何價值嗎?)
Using querySelectorAll(). Is the result returned by the method ordered?(使用 querySelectorAll().方法返回的結果是否有序?)
Safari bug :first-child doesn#39;t update display:block when items are removed with JS(Safari 錯誤:當使用 JS 刪除項目時,first-child 不更新 display:block)
nth-Child CSS selectors(nth-子 CSS 選擇器)
CSS: Select element only if a later sibling exists(CSS:僅當存在較晚的兄弟時才選擇元素)
主站蜘蛛池模板: 欧美精品亚洲 | 日韩免费在线视频 | 日韩一区二区三区视频 | 中文字幕久久久久 | 四虎在线免费观看 | 免费毛片网站 | 国产肉体xxxx裸体784大胆 | 毛片网站视频 | 中文字幕日韩高清 | 国产黄视频在线观看 | 天堂网在线播放 | 国产一区二区网站 | 国产精品欧美在线 | 亚洲精品久久久久 | 福利片国产 | 少妇高潮久久久久久潘金莲 | 黄色特级片| 成年人免费看视频 | 国产精品伦子伦免费视频 | 日韩国产精品视频 | 不卡视频一区二区 | 黄色小视频在线免费观看 | 校园春色综合网 | 巨骚综合 | 人人爽人人爽人人 | 久久久久久久国产精品 | 国产午夜影院 | 你懂的在线网站 | 国产精品视频免费看 | 深夜福利视频网站 | 国产精品福利在线 | 日本公妇乱偷中文字幕 | 久久99精品久久久久久琪琪 | 成年人视频网站 | 99视频+国产日韩欧美 | a在线播放 | 久久久一区二区三区 | 久久91精品 | 日本香蕉视频 | 国产精自产拍久久久久久蜜 | 四虎www |