CSS Element Selectors

CSS Element Selectors

The element element selector in CSS is used to select elements inside the elements i.e., it combines two selectors such that elements matched by the second selector are selected if they have an ancestor element matching the first selector.

Syntax :

Syntax
element element {
    // CSS Property
}

Observe how styling is applied in the below HTML code.

ApplyStylesFinal

Demo

CODE/PROGRAM/EXAMPLE
<!doctype html>
<head>
    <title>
        Element Selectors Tryout
    </title>
    <meta charset="UTF-8"> 
    <style>
        table {
            background-color: red;
        }

        td {
            color: green;
        }
    </style>
</head>

<body>
    <form action="" method=post name=form1>
        <table border=3 cellpadding=1 cellspacing=1 width="75%">
            <tr>
                <td>Enter your Name</td>
                <td><input type="text" name="name" /></td>
            </tr>
            <tr>
                <td>Enter your Password</td>

                <td><input type="password" name="password" /></td>
            </tr>
            <tr>
                <td><input type="submit" name="submit" value="Submit Form" />
                <td><input type="reset" name="reset" value="Reset Form" />
            </tr>
        </table>
    </form>
</body>
</html>
#css_element_selector #CSS_Element_Selectors #css_selectors #css_nth_child #css_pseudo_classes #css_attribute_selector #css_child_selector #css_class_selector #css_id_selector

(New page will open, for Comment)

Not yet commented...