css selectors - is there a way to select a child element of an element using css -
example below should comprehend question.
<div id="bmw" class="car"> <div class="seats">4</div> <div class="fuel">petrol</div> </div> <div id="merc" class="car"> <div class="seats">2</div> <div class="fuel">petrol</div> </div> using css can select seats element of bmw element. don wanna add class tag child elements of bmw
and how select seats of car class elements
<div id="bmw" class="car"> <div class="seats">4</div> <div class="fuel">petrol</div> </div> <div id="merc" class="car"> <div class="seats">2</div> <div class="fuel">petrol</div> </div> <div id="mazda" class="truck"> <div class="seats">2</div> <div class="fuel">diesel</div> </div> and how select element both car , seat classes
<div id="godrej" class="car seat"> <div class="hands">0</div> </div>
#bmw .seat{} .car .seat{} in first rules apply elements class seat inside element id bmw.
in second elements has both class car , seat.
.car.seats{} this apply element both in class="" property
.car .seats{} //with space in between this apply elements have parent class car , child class seats.
Comments
Post a Comment