I have an elements:

<div id="mydiv" class="mydivclass">


In CSS i have like:

div#mydiv {
width: 100px;
div.mydivclass {
width: 200px;

What i want is to the second CSS (class) setting override the first (id) one. The thing is that the class is added dynamically and i want that element to be styled differently if the class is there, however, it is always styled using the id styling property.


Silly me, !important did the job (just posting if anyone else needs to know this).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.