ASP.NET - Can a <div> tag not be influenced by the style sheet in a page which using the same
Asked By Pranay on 12-Dec-12 03:39 PM
I have a div tag in a page which is using style sheet. I was wondering if there is a way so that the div tag does not take properties from the style sheet and remain uninfluenced.
I know, I can render properties at tag level which would override the style sheet but I'm in a wierd situation where I'm not sure which properties to cancel out.... so I was wondering. Otherwise I'll have to do it hard way.
Pranay replied to Robbe Morris on 12-Dec-12 04:29 PM
I'm using master content pages. In master page, I've two links refering to two different stylesheets. One style sheet is for the master-content page and another one is for a gantt chart I'm using inside the div*. Now, the div* in consideration is in content page and has its own css class (as you mentioned). This div works fine when I remove the first css file link from the master page header but in its presence it does not give desired output. I tried to figure out what properties where causing that behaviour to the tag but failed. That's why I asked the same.
I also tried to combine the two stylesheets but still no luck.
Thanks for your time and help.
Robbe Morris replied to Pranay on 12-Dec-12 04:47 PM
The fact that the same css class exists in two different files does not make two separate instances of the class when the browser renders your page. They all get combined into one in memory. So, it sounds like you may want css class properties cancelling out certain properties at runtime. If I understand the issue correctly.
You "may" want to prefix your css classnames that are designated for masterpage usage in order to keep it from interfering with the rest of your pags.