Online visitors

People learning around the world

Online

—

Visitors exploring W3Schools

Online visitors by country Circles show approximate country locations. The country list provides the visitor counts.

Circles represent countries, not exact visitor locations.

Country

Online

Loading country activity…

    CSS Element Selector

    CSS Element Selector is a straightforward CSS selector that uses the name of any HTML element as a selector for applying the CSS styles on those elements.

    Syntax:

    html_tag{
    /* declarations */
    }

    Below is an example of a element selector implemented on paragraphs:

    CSS Element Selector Example

    Example:

    <!DOCTYPE html>
    <html>
    
        <head>
            <style>
                p { font-family: Arial, Helvetica, sans-serif; font-size:14px; color:#666699; } 
            </style>
        </head>
    
        <body>
            <p>The CSS style will get implemented in every paragraph element.</p>
            <p id="para1">This paragraph will also get affected.</p>
            <p>And This one will also get affected as element selector is set for 'p' i.e. all paragraph.</p>
        </body>
    
    </html>

    In the above example, the CSS Element selector has been applied to the HTML paragraph element. And all the paragraphs are being affected.



    Found This Page Useful? Share It!
    Get the Latest Tutorials and Updates
    Join us on Telegram

    Notifications

    Updates are enabled for this browser.

    Receive new tutorials, articles and learning resources. You can turn updates off anytime.