Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> การเขียนโปรแกรม >> CSS

เลือกทุก <div> และ <p> พร้อมกันด้วย CSS

หากต้องการจัดสไตล์หลายองค์ประกอบพร้อมกัน ให้ใช้เครื่องหมายจุลภาค (,) คั่นแต่ละองค์ประกอบ

ตัวอย่าง

<!DOCTYPE html> <html>    <head>       <style>          div, p {             color: blue;             background-color: orange;          }       </style>    </head>    <body>       <h1>Demo Website</h1>       <h2>Fruits</h2>       <p>Fruits are good for health.</p>       <div>          <p>This is demo text.</p>       </div>    </body> </html>