473,396 Members | 1,846 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Ignore CSS for a partcular div in the page

Hi,

I am working on a Widget that gets embedded into an existing page as a div in the body...Now I want to ensure that the my widget looks and behaves exactly the same on all web sites.

But I am running into issues where customers have setup global CSS rules for all sorts of elements like

table {border:1px solid}
a {text-decoration:underline}
etc.

Now is there a clean way for me to ignore all these rules without writing rules for each and very possible property?

Thanks,
Jitendra
Apr 5 '07 #1
8 14106
drhowarddrfine
7,435 Expert 4TB
Add !important to the css property and it will override the user rule.
Apr 5 '07 #2
I don't think that will work...I'll have to set properties for each conceivable element and all properties for each element...that could be a tall task...
Apr 5 '07 #3
Instead of using general rules set span class rules.
Apr 5 '07 #4
drhowarddrfine
7,435 Expert 4TB
Then there is no other way to override user CSS rules.

Now that I re-read the original post, I should say that I was thinking you meant user CSS on the individual browser. If you meant they import some global CSS file, then as long as your CSS follows theirs, then the cascade will take care of what you want. You can modify what they have but you can't delete what they have.
Apr 5 '07 #5
KevinADC
4,059 Expert 2GB
Yea, thats pretty much why they are called Cascading Style Sheets. Plus I doubt other people would like the fact you control the appearance of content that gets displayed on their site (If I understand your situation). Besides, they could just slurp your html code up and alter it anyway they want to if they know some server side stuff. All in all it sounds like a concept that is not practical.
Apr 5 '07 #6
An example of the scenario I am thinking of available at Techcrunch

Steps:

1. Go to techcrunch.com
2. Click on the "sphere it" link at the end of each post
3. this causes a new div to get generated

This div popup works the same across mutiple sites... (check out www.readwriteweb.com for another example). Now these popups are custom to the site...But my question is that is there a way to generate this kind of popup without having to worry about the site specific CSS and without having to define the all CSS properties for all elements.

Thanks every one for the responses thus far.
Apr 5 '07 #7
KevinADC
4,059 Expert 2GB
The answer is: no. And you should not even be trying to do that. It's a bad idea, its not practical, and it can still be defeated even if you define ever CSS property known to man within the div itself.
Apr 5 '07 #8
It's very practical. The need to do this, normally with included HTML just like the scenario suggested, comes up all the time. There should be a CSS property that specifies css file names to read or ignore when computing the cascade. Of course it can be "defeated." That's not the point. We aren't talking about potential malicious behavior here. We are talking about convenience. The ability to ignore certain css files would be VERY convenient.
Nov 12 '10 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: Nicolas Fleury | last post by:
Hi all, The part of the Python community that doesn't like @decorators needs to unite behind an alternative syntax to propose to Guido. I suggest we use this thread to try to do it. If you...
6
by: CJM | last post by:
I have a page which allows the user to open one of several spreadsheets by streaming the XLS to the client. On my development site, everything appears to work fine. On the live site, it works...
2
by: Daniel | last post by:
Ok folks, I have Windows XP. I installed .Net and developed some VB.Net components that I want to use in ASP.Net applications. At this point I realized I didn't have IIS installed on my XP...
10
by: john | last post by:
I want the page to completely ignore all mouse clicks. I can create the onmouseclick event and return false, but that only disables certain types of things. I can still, for example, click in a...
6
by: Kevin G. | last post by:
I'm not sure if this is possible, but if a page uses a CSS style sheet and you would still like to use good old <font> tags... is there a tag to tell the browser to ignore the CSS formatting just...
1
by: windandwaves | last post by:
Are you allowed to use the following syntax in Mysql 4.0.17-nt : INSERT DELAYED IGNORE INTO `mytable` ( `ID` , `A` , `B` ) VALUES ("'.session_id().'", "2", ROUND(NOW()/10000) ); I am...
2
by: twahl | last post by:
Hi, I would like to ignore a certain exceptions in Application_Error event in Global.asax.cs file and still have the page's state be maintained. If I simply issue: Server.ClearError() I end...
4
by: Jon Westmore | last post by:
I'm using an ASP page to dynamically generate an XML document using a data source. I was thinking the concept would be similar to dynamically creating HTML but I'm running into an issue. Here is...
1
by: Ganesh | last post by:
Hi There, I've a validation control in my page, In some cases i don't want to check the validation like when users click cancel, i'l take the page to home page. But it checks always validation....
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.