Tuesday, December 30, 2014

Select first element of the same class.

<style type="text/css">

.group .element:first-child {
 color: red;
}

div{
font-size: 25px;
font-weight: bold;
font-family: verdana;
}

</style>

<div class="group">
    <div class="element">CSS Tution</div>
    <div class="element">CSS Tution</div>
    <div class="element">CSS Tution</div>
    <div class="element">CSS Tution</div>
</div>

<div class="group">
    <div class="element">CSS Tution</div>
    <div class="element">CSS Tution</div>
    <div class="element">CSS Tution</div>
    <div class="element">CSS Tution</div>
</div>

<div class="group">
    <div class="element">CSS Tution</div>
    <div class="element">CSS Tution</div>
    <div class="element">CSS Tution</div>
    <div class="element">CSS Tution</div>
</div>


Output :)


No comments:

Post a Comment