Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    Regular Coder
    Join Date
    Jun 2002
    Posts
    553
    Thanks
    0
    Thanked 0 Times in 0 Posts

    override stylesheet definition?

    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

  • #2
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,701
    Thanks
    6
    Thanked 1,011 Times in 984 Posts
    Show us that site. These few CSS rules tell us nothing.
    As a last resort you can use the !important keyword.
    Code:
    selector {
      property: value !important;
    }

  • #3
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,675
    Thanks
    22
    Thanked 1,827 Times in 1,811 Posts
    Hello gorilla1,
    Inline styles will take precedence too. Like this - <div id="column2" style="position: relative;"></div>
    Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
    Use the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad

  • #4
    Regular Coder
    Join Date
    Jun 2002
    Posts
    553
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  • #5
    Senior Coder
    Join Date
    Aug 2010
    Location
    High Point, NC
    Posts
    3,338
    Thanks
    5
    Thanked 363 Times in 360 Posts
    Quote Originally Posted by gorilla1 View Post
    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.
    Teed

  • #6
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,701
    Thanks
    6
    Thanked 1,011 Times in 984 Posts
    Quote Originally Posted by gorilla1 View Post
    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 can do this, Firebug possibly too.

  • #7
    Senior Coder alykins's Avatar
    Join Date
    Apr 2011
    Posts
    1,758
    Thanks
    41
    Thanked 191 Times in 190 Posts
    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

    I code C hash-tag .Net
    Reference: W3C W3CWiki .Net Lib
    Validate: html CSS
    Debug: Chrome FireFox IE

  • #8
    Regular Coder
    Join Date
    Jun 2002
    Posts
    553
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •