CSS3 > Selectors

ID selector in CSS3

How to specify CSS style for an element whose ID specified in CSS3?

ID selector is used to specify css style for an element whose id specified.

        #myId {
            background-color: Fuchsia;
            border: 1px solid #c0c0c0;

    <div>This is Empty Div</div>
    <div id="myId">This is Div with ID</div>
    <div>This is Empty Div</div>

In the above code snippet we can notice that, there are three <div> tags. In that ID selector is applied to the 2nd <div> tag.


 Views: 3785 | Post Order: 5

Write for us

Hosting Recommendations