Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Select second 2nd child div from within the parents div

Tags:

css

Hi I'm having problems selecting the second div from it's parent div.

Here is what I'm using:

.manufacturer_box div:nth-child(2){
 border-top: 2px solid #e0e0e0; 
 }

This is the output:

<div class="manufacturer_box">
    <div class="manufacturer_title">
        <h1>Title</h1>
        </div>
    <div style="border-top: 1px solid #e5e5e5; width: 100%; line-height: 22px;">
        <span style="color: #999999; font-size: medium;"><br> 
        <span style="color: #333333;"></span> </span>
    </div>
</div>

Would appreciate any help.

like image 810
Tonzkie Avatar asked Jul 19 '13 01:07

Tonzkie


Video Answer


1 Answers

You need to remove inline style from the second div tag

<div style="border-top: 1px solid #e5e5e5; width: 100%; line-height: 22px;">

It is overriding your css style.

For whatever reason if you want to keep the style, use !important although I highly DO NOT recommend this approach because it is very very bad practice but that's an option (however bad).

    .manufacturer_box div:nth-child(2) {
            border-top: 5px solid #e0e0e0 !important; 
     }
like image 144
Venkata Krishna Avatar answered Sep 28 '22 17:09

Venkata Krishna