Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to select an html element that has two class names?

Tags:

html

css

frontend

IE7 doesn't support :last-child pseudo selector. I am thinking of explicitly adding a class name to denote it as the last element but not sure how to select this element inside a css file. Anyone have any ideas on how to do this ?

like image 985
Vamsee Avatar asked May 27 '09 11:05

Vamsee


2 Answers

.class1.class2 {color:red}

and

<div class="class1 class2"></div>

or install IE7-js and :last-child will "just work".

like image 93
SpliFF Avatar answered Nov 12 '22 14:11

SpliFF


If you have

<div class="element"/>
<div class="element last"/>

You can just do

div.element
{
   // styles effect both divs
}

div.last
{
    // style will only effect the second element and overides because lower in the css
}
like image 37
Nick Allen Avatar answered Nov 12 '22 13:11

Nick Allen