Mario
Mario

Reputation: 1253

Stop element.style to overwrite my css styles

I'm developing a form in ruby on rails and in that form I'm using a slider (http://seiyria.github.io/bootstrap-slider/).

The problem is that I have this element.style that overwrites my css like this:

For stored field: enter image description here

When I add a new field dynamically: enter image description here

What is this element.style?

Why this element.style overwrites the width?

This element.style width has the value 0px in the first case and 152px in the second, and I have no ideia why.

Any help?

Upvotes: 0

Views: 1448

Answers (1)

henry
henry

Reputation: 4385

Add !important to the rule you don't want overridden. E.g. .slider.slider-horizontal {width: 210px}

(using !important is often frowned on, because it can initially enable poorly-structured CSS, and then go on to make your styles extra messy as you start having to use more !important's to override earlier !important's, but there are definitely times when you just have to use it)

Upvotes: 1

Related Questions