Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to clear all css styles

Tags:

html

css

widget

I'm creating a snippet of HTML to allow others to add functionality to their web sites (it is a voting widget). I've created a snippet of HTML like this:

<div>
   [implementation of my voting widget]
</div>

I spent a lot of time to get the formatting of this widget just right. It works great in a sample web page that does not import a style sheet.

When I add the widget to a page on a Drupal site, however, the imported CSS wreaks havoc with my careful formatting. I'd like my HTML snippet to ignore all CSS style sheets. Is this possible?

Regardless of whether it is possible, is there a better solution?

like image 936
gaefan Avatar asked Mar 28 '11 04:03

gaefan


1 Answers

Instead of relying on your CSS styles not being overridden by any imported stylesheets, you should give your widget a unique id and make sure all of your styles are a derivative of that id making sure to implement any styles you don't want to be overriden (margin, padding, etc):

<div id="votify">
   [implementation of my voting widget]
</div>

#votify {}
#votify ul {}
#votify div span {}
/* etc */
like image 187
mVChr Avatar answered Sep 22 '22 11:09

mVChr