Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I select this element?

I have code blindness, it's like snowblindness, just wth far too much code.

I have a div class dynamically generated,

<div class="even last"> 

How can I select that with CSS?

div.even last {
    background-color:#ffffff;
    height:100%;
    border-top:1px solid #F5F5F5;
    padding:2px;
    margin-top:35px;
}

Doesn't seem to work, and I just can't think more..

Thanks :)

like image 389
Kyle Avatar asked Dec 29 '25 19:12

Kyle


2 Answers

When multiple classes are specified with a space, it applies both of those classes to the element.

Therefore if you specify div.even AND/OR div.last it will use them.

like image 154
cjk Avatar answered Jan 01 '26 11:01

cjk


You cannot have spaces in a css class name. This should work:

<div class="even_last"> 

div.even_last {
    background-color:#ffffff;
    height:100%;
    border-top:1px solid #F5F5F5;
    padding:2px;
    margin-top:35px;
}

Spaces in css mean: the next element contained in the previous one, for example:

<div class="even_last">
    <div>
        Hello
    </div>
    World
</div>

div.even_last div {
    font-weight:bold;
}

Hello will be bold, while World will not.

like image 40
Philip Daubmeier Avatar answered Jan 01 '26 10:01

Philip Daubmeier



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!