設定每個
具有 lang 屬性值的元素的樣式,使用 CSS
使用 CSS:lang 選擇器來設定具有 lang 屬性值的每個 <p> 元素的樣式。你可以嘗試執行以下程式碼來實現:lang 選擇器
示例
<!DOCTYPE html> <html> <head> <style> p:lang(fr) { background: green; } </style> </head> <body> <p>This is my country</p> <p lang = "fr">C'est mon pays</p> <p>French is the language of France</p> </body> </html>
廣告