...

View Full Version : override stylesheet definition?



gorilla1
11-18-2011, 10:09 PM
I am working on a site where there are stylesheets above mine that I cannot touch. I am trying to add some material in column 2 in a div within the column 2 div and the definition in one of the stylesheets I can't change is disrupting the layout. Is there a way to override this definition.
#column2 * {
position:static;
}

My div is called content-block. I tried the following, but it did not resolve the issue:
#content-block * {
position:relative;
}
I also tried coding the following in stylesheet lower in the search:
#column2 * {
position:relative;
}
but this did not do it either.

G

VIPStephan
11-18-2011, 10:25 PM
Show us that site. These few CSS rules tell us nothing.
As a last resort you can use the !important keyword.


selector {
property: value !important;
}

Excavator
11-18-2011, 10:43 PM
Hello gorilla1,
Inline styles will take precedence too. Like this - <div id="column2" style="position: relative;"></div>

gorilla1
11-22-2011, 06:44 PM
Thanks for the great ideas. None worked though. The '!important' did not result in override. The element that has the css that i am trying to override I cannot put inline styling by because that part of the markup is produced by a script that I cannot control. I can't share the page because it is behind a paywall.

G

teedoff
11-22-2011, 06:57 PM
I am working on a site where there are stylesheets above mine that I cannot touch. I am trying to add some material in column 2 in a div within the column 2 div and the definition in one of the stylesheets I can't change is disrupting the layout. Is there a way to override this definition.
#column2 * {
position:static;
}

My div is called content-block. I tried the following, but it did not resolve the issue:
#content-block * {
position:relative;
}
I also tried coding the following in stylesheet lower in the search:
#column2 * {
position:relative;
}
but this did not do it either.

G

As mentioned, inline styles take precedence over all other styles. Then embedded styles are rendered BEFORE linked or external stylesheets. The div element you want to change has an id of content-block? Why not create an embedded style in your page's <head> section with the same id, content-block, and then style it that way. This would override any external styles for THAT element.

VIPStephan
11-22-2011, 09:50 PM
Thanks for the great ideas. None worked though. The '!important' did not result in override. The element that has the css that i am trying to override I cannot put inline styling by because that part of the markup is produced by a script that I cannot control. I can't share the page because it is behind a paywall.

G


If styles are created with JavaScript then they will be inline styles so the only way to override them would be with !important and possibly a selector with a higher specificity. However, it’s really hard to tell without seeing the code.

You could help us by doing one thing: Post the generated source code here, i. e. the HTML as the browser sees it after being manipulated by JavaScript, and highlight the relevant section. Firefox’s web developer toolbar (http://chrispederick.com/work/web-developer/) can do this, Firebug possibly too.

alykins
11-23-2011, 04:47 PM
have to ask if you are not allowed to change something is it because they state that in their term/conditions? if that is the case then you cannot even be asking how to do so. (ie we cannot help you violate T&C)

otherwise I have to ask why you can't change it? and also reiterate (what others have said) without code (or site) we cannot help much

gorilla1
11-30-2011, 07:00 PM
have to ask if you are not allowed to change something is it because they state that in their term/conditions?

There is a server that generates the web pages. Part of the web page are css files that the platform provider builds. I have a css file that is included below their css files. Therefore I cannot touch their css file, but I can override styling that it contains. It has nothing to do with any terms or conditions. It is a pretty straightforward arrangement, so I apologize if my prior descriptions did not make it clear. As I stated at the top, i have found no way to override their definition
#column2 * {
position:static;
}
though i have tried some of the helpful suggestions. If I get time I suppose I could try and rig up an approximation of this on another server, but I may not have time to do that.

G



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum