CSS element,element Selector Last Updated : 29 Aug, 2024 Comments Improve Suggest changes Like Article Like Report The element, element selector in CSS is used to style all comma-separated elements with the same style.Syntax:element,element { /* CSS Property */}Example 1: html <!DOCTYPE html> <html> <head> <title> element, element Selector </title> <style> /* Add same CSS property to all comma separated elements */ h1, h2, div, p { text-align: center; } div, p { background-color: green; color: white; } </style> </head> <body> <h1 style="color: green;"> GeeksforGeeks </h1> <h2>element, element Selector</h2> <div> A computer science portal for geeks. </div> <p>Welcome to geeks classes.</p> </body> </html> Output:Example 2: html <!DOCTYPE html> <html> <head> <title> element, element Selector </title> <style> /* Add same CSS property to all comma separated elements */ h1, h2, p { text-align: center; } ul, p { background-color: green; color: white; } </style> </head> <body> <h1 style="color: green;"> GeeksforGeeks </h1> <h2>element, element Selector</h2> <p>Welcome to geeks classes.</p> <div>Different algorithm techniques:</div> <ul> <li>Searching Algorithms</li> <li>Sorting Algorithms</li> <li>Graph Algorithms</li> </ul> </body> </html> Output:Supported Browsers:Apple SafariGoogle ChromeFirefoxOperaInternet Explorer Create Quiz Comment V Vishal Chaudhary 2 Follow 0 Improve V Vishal Chaudhary 2 Follow 0 Improve Article Tags : Web Technologies CSS CSS-Selectors Explore CSS Introduction 3 min read CSS Syntax 3 min read CSS Selectors 6 min read CSS Comments 2 min read CSS Colors 5 min read CSS Borders 5 min read CSS Margins 4 min read CSS Height and Width 4 min read CSS Outline 4 min read CSS Fonts 4 min read Like