Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to overwrite css style

Tags:

html

css

I'm developing pages, now in my css style I have this line of code

.flex-control-thumbs li {     width: 25%;     float: left;     margin: 0; } 

for my pages. Now, some of my pages don't need this line

width: 25%; float: left; 

It is possible that I can overwrite it in internal css of the page, which will cause the original behaviour to be ignored?

like image 370
gadss Avatar asked Oct 29 '12 06:10

gadss


People also ask

How do you overwrite CSS in HTML?

... or add a <style> element in the <head> of your HTML with the CSS you need, this will take precedence over an external style sheet. You can also add !

How do I overwrite global CSS?

you can try ol>li::before, ul>li::before {content: initial ! important!}


2 Answers

Using !important is not recommended but in this situation I think you should -

Write this in your internal CSS -

.flex-control-thumbs li {   width: auto !important;   float: none !important; } 
like image 185
Dipak Avatar answered Sep 27 '22 16:09

Dipak


instead of overwriting, create it as different css and call it in your element as other css(multiple css).
Something like:

.flex-control-thumbs li  { margin: 0; } 

Internal CSS:

.additional li {width: 25%; float: left;} 

<ul class="flex-control-thumbs additional"> </ul> /* assuming parent is ul */ 
like image 42
Mr_Green Avatar answered Sep 27 '22 16:09

Mr_Green