CSS3 > Selectors

Descendant selector in CSS3

How to specify CSS style for the Descendant of the parent element in CSS3?

Descendant selector is used to specify css style for the descendent of the parent element.

        .myGallery li {
            background-color: Fuchsia;
            border: 1px solid #c0c0c0;

    <div style="background-color: #efefef; padding: 50px; height: 150px;">
        <ul class="myGallery">
                <img src="../images/dotnetlogo.gif" /></li>
                <img src="../images/iconnectin.gif" /></li>
                <img src="../images/itfunda.gif" /></li>
                <img src="../images/myfundalogo.gif" /></li>

In the above code snippet, we applied class to the <ul> tag and the images are place inside the <li> tags.


 Views: 3449 | Post Order: 6

Write for us

Hosting Recommendations