如何同時將樣式套用到多個類別?
For Applying Styles to Muitliple classes at once we are going to use dot(.) selector and comma(,). In this article, we will use the dot (.) selector and select all the elements with their class names using the selector and separated by a comma (,).
「class」 是一個HTML屬性,它接受由空格分隔的類別清單。這些類別可以在CSS中用於為特定元素設定樣式,或在javascript中用於操作這些HTML元素。
Example 1
In this example, we will apply the font color “red” to the HTML elements that have classes “header” and “para”. We will achieve this using the dot (.) selector and concatenating them with a comma (, ).
<!DOCTYPE html> <html lang="en"> <head> <title>How to apply styles to multiple classes at once?</title> <style> .header, .para { color: red; } </style> </head> <body> <h3 class="header">How to apply styles to multiple classes at once?</h3> <p class="para">Lorem ipsum dolor sit amet consectetur adipisicing elit.</p> </body> </html>
Example 2
在這個範例中,我們將把字體顏色設為「green」並將字體樣式設定為「italic」套用到具有類別名稱「header」和「para」的HTML元素上。我們將使用點(.)選擇器,並將它們與逗號(,)連接起來來實現這一目標。
<!DOCTYPE html> <html lang="en"> <head> <title>How to apply styles to multiple classes at once??</title> <style> .header, .para { color: green; font-style: italic; } </style> </head> <body> <h3class="header">How to apply styles to multiple classes at once?</h3> <p class="para">Lorem ipsum dolor sit amet consectetur adipisicing elit.</p> </body> </html>
結論
In this article, we learned how to apply multiple CSS classes at once. We did this by first, selecting multiple classes at once, using the dot (.) selector provided by the the CSS, and then assigning them the quired them thes thes in CSS, and then assigning them the CSS the stylesheet.
以上是如何同時將樣式套用到多個類別?的詳細內容。更多資訊請關注PHP中文網其他相關文章!

熱AI工具

Undresser.AI Undress
人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover
用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool
免費脫衣圖片

Clothoff.io
AI脫衣器

Video Face Swap
使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱門文章

熱工具

記事本++7.3.1
好用且免費的程式碼編輯器

SublimeText3漢化版
中文版,非常好用

禪工作室 13.0.1
強大的PHP整合開發環境

Dreamweaver CS6
視覺化網頁開發工具

SublimeText3 Mac版
神級程式碼編輯軟體(SublimeText3)

您是否曾經在項目上需要一個倒計時計時器?對於這樣的東西,可以自然訪問插件,但實際上更多

我關注的一件事是Lea Verou&#039; s conic-Gradient()Polyfill的功能列表是最後一項:
