HTML5&details標籤屬性
HTML5中新增的標籤允許用戶創建一個可展開摺疊的元件,讓一段文字或標題包含一些隱藏的信息。
HTML5標籤用法
一般情況下,details用來對顯示在頁面的'內容做進一步驟解釋。其展現出來的效果和jQuery手風琴插件差不多。
其大致寫法如下:
Google Nexus 6
商品詳情:
屏幕
5.96” 2560x1440 QHD AMOLED display (493 ppi)
電池
3220 mAh
13MP rear-facing with optical image stabilization 2MP front-facing
處理器
Qualcomm Snapdragon 805 processor
首先是
標籤,裏面接着是標題,這裏面的內容一般簡短,具有總結性,會展示在頁面。接着可以跟任意類型的HTML元素作爲詳情內容,這些內容需要在點擊
纔會呈現。
上面代碼呈現出來的效果會是下面這樣的:
最開始詳情是隱藏的,當點擊時都會展現。
open 屬性
當然,你也可以通過給
標籤設置open屬性讓它默認爲展開狀態。
Google Nexus 6
商品詳情:
屏幕
5.96” 2560x1440 QHD AMOLED display (493 ppi)
電池
3220 mAh
相機
13MP rear-facing with optical image stabilization 2MP front-facing
處理器
Qualcomm Snapdragon 805 processor
此時默認會把詳情展開,而點擊標題後會摺疊起來。
示例
示例如上面那樣,預覽在線版本可點擊此處。
瀏覽器兼容性
由於是HTML5新標籤,瀏覽器支持情況不是很理想。從來自caniuse的數據來看,目前僅Chrome, Safari 8+ 和Opera 26+支持此標籤。
可喜的是,如果你在caniuse開啓了「顯示來自UC瀏覽器的結果」 選項的話,會發現,國產的UC瀏覽器也支持了此標籤。
相關文章
-
At Climate Summit, Hope for Emissions Deal美文欣賞
It's known as "the roof of the world," four thousand seven hundred meters above sea level lies the Tibetan Plateau. Its glaciers are the source of many of Asia’s most important rivers.But the ice -
php函數method-exists()與is-callable()有何區別
php函數method_exists() 與is_callable()的區別在哪?在php面相對象設計過程中,往往我們需要在調用某一個方法是否屬於某一個類的時候做出判斷,常用的方法有 method_exists()和is_callable(),相比之下,is_callable()函數要 -
人教PEP版國小五年級英語下冊Unit3Myschoolcalender.ALet’stalk
本部分學習的核心句型是:Whenistheparty?It’sinApril.教材通過Mike和張鵬對校歷上四、五月要舉行的活動的討論場景,介紹了孩子們在春天將有很多趣味性活動的情景,即四月的運動會個萬聖節聚會、五月的春遊,讓學生感知上述 -
Jolie drops battle over perfume named Shilohy英語作文
angelina jolie has dropped her legal battle with a perfume-maker who had named her fragrance shiloh - the same as jolies youngest daughter.jolie had filed a note with the u.s. patent and trademark off -
The summer holiday plan英語作文
The summer holiday planThe summer holiday is coming. It is a great time to do something interesting.In my class, talking there are it. many Some classmates about students are going to travel with thei -
The First Time to Make Dumplings英語作文及譯文
I am good at study, I can always get the high mark in the exam, so I am very confident that I can do all the things well, but the experience of making dumplings changes my idea. It was on winter holid -
英語材料閱讀:with mental and physical disorders
The biggest differences between the Mensa group and the general population were seen for mood disorders and anxiety disorders. More than a quarter (26.7%) of the sample reported that they had been for -
最新《Fate/Stay Night Unlimited Blade Works》經典名句
品牌型號:iPhone12系統:IOS15 以iPhone12爲例,蘋果手機屏幕變暗可以關閉自動亮度調節。分爲2步,步驟如下: -
瞭解HTML中table表格的frame和rules屬性
大學生社會社會實踐報告經過長途跋涉,我們終於走進了呂梁,走進柳林,也走進了一個陌生的世界。 我對山區的認識是從賀家坡鄉的楊家凹開始的。爲了支持我們的活動,縣裏專門派車接送我們,協助我們的工作。 對我來說,兩個月前玩 -
HTML meta viewport屬性說明
什麼是Viewport手機瀏覽器是把頁面放在一個虛擬的“窗口”(viewport)中,通常這個虛擬的“窗口”(viewport)比屏幕寬,這樣就不用把每個網頁擠 到很小的窗口中(這樣會破壞沒有針對手機瀏覽器優化的網頁的佈局),用戶可以通過平移