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 3 of 3

Thread: Overridding CSS

  1. #1
    Senior Coder jerry62704's Avatar
    Join Date
    Oct 2007
    Location
    Springfield, IL
    Posts
    1,100
    Thanks
    13
    Thanked 87 Times in 87 Posts

    Question Overridding CSS

    There is a "stock" CSS and our local variations. I don't have access to the stock stuff. But there is a value I want to change in it:

    Code:
    #TopRightDiv {
      z-index: 0;
      position: relative;
      clear: both;
      width: 100%;
      min-height: 98px;
      _height: 98px;			/* IE hack: IE only sees it - IE doesn't have min-height */
      _height /**/: 100px;		/* IE hack: IE5.x only sees it */
      margin: 1px 0 0 0;
      padding: 1px 0;
      background: #644F81 url("images/BannerBackground.jpg") no-repeat 0 0;}
    
    #BannerDiv {
      position: absolute;
      top: 0;
      right: 0;
      height: 100px;}
    I don't want that "1px" in the margin. It is applied here:
    Code:
        <%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html" %>
    	<div id="TopDiv"> 
     	        <div id="TopLeftDiv">
    		        <div id="HeaderDiv">
    			          <a href="http://www.dhs.state.il.us">
    			          <html:img page="/theme/images/DHSLogo.gif" alt="DHS" /><br />
    			          <span class="agency">Illinois Department of Human Services</span><br />
    			          <span class="secretary">Carol L. Adams, Ph.D., Secretary</span></a>
    		         </div>
    	         </div>
    	         <div id="TopRightDiv">
    		          <div id="BannerDiv">
    			            <html:img page="/theme/images/banner.jpg" alt="Helping Families. Supporting Communities. Empowering Individuals." />
    		          </div>
    	         </div>	
      	</div>
    I had thought to add this:
    Code:
    /* override the DHS CSS at http://www.dhs.state.il.us/Sites/OneWeb/Site.css */
    		#TopRightDiv #BannerDiv img{
    			margin: 0;
     		}
    to my CSS, but that didn't work. Being less specific (#TopRightDiv {...} in the CSS I have access to) will remove the protected stuff, but it's not a good idea to do that.

    Any better ideas?
    .
    .
    ...and gladly would he learn and gladly teach

    Visit www.LiberalsWin.com for humor and the unique Bush/Obama Approval Polls

  • #2
    Senior Coder jcdevelopment's Avatar
    Join Date
    Oct 2007
    Location
    Cowboy Nation
    Posts
    2,182
    Thanks
    174
    Thanked 257 Times in 257 Posts
    Code:
    #TopRightDiv #BannerDiv img{
    margin: 0;!important
     }
    would that just solidify it by adding important, or would that make a difference?

  • #3
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    Put another stylesheet or set of styles after the stock.css file
    Code:
    #TopRightDiv {
    margin: 0;
    How would #BannerDiv img be what you use when their is no margin even applied to it? I suggest you learn the reason of why CSS is what it is. Learn what CSS stands for.
    ||||If you are getting paid to do a job, don't ask for help on it!||||


  •  

    Posting Permissions

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