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
  1. #1
    New Coder
    Join Date
    Apr 2008
    Posts
    34
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Div background trick...

    What I'm trying to do is get three divs and line them up vertically so that they all connect together forming a seamless background. I have 3 images I need to use for the background and they are: the main vertically repeating background, and two images--top and bottom--which will give the effect that they are completing the rounded corner of the top and bottom of the outer div. I have tried using the css3 technique where I have one background image which repeats, and then the two top and bottom of the div which completes the rounded border, but since the images are semi-transparent, they are overlapping and causing the image to be darker then I want.

    Here is an example of the darkening I'm talking about:


    I'm looking for a solution which will allow me to have everything set up to using an html element rather than relying on css3 to render 3 background images, it doesn't work in IE anyway.

    Here is a picture of what I'm trying to do, where each color represents a new div or an html element:


    Thanks I hope someone can help.

  • #2
    Senior Coder Rowsdower!'s Avatar
    Join Date
    Oct 2008
    Location
    Some say it's everything.
    Posts
    2,027
    Thanks
    5
    Thanked 397 Times in 390 Posts
    Give us a link to your test page and we can be of much more assistance in debugging the problem. As a first step, have you validated your HTML?
    The object of opening the mind, as of opening the mouth, is to shut it again on something solid. G.K. Chesterton
    See Mediocrity in its Infancy
    It's usually a good idea to start out with this at the VERY TOP of your CSS: * {border:0;margin:0;padding:0;}
    Seek and you shall find... basically:
    validate your markup | view your page cross-browser/cross-platform | free web tutorials | free hosting

  • #3
    New Coder
    Join Date
    Apr 2008
    Posts
    34
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I know what the problem is, I don't know how to fix it.

    Here is how my content boxes are set up:

    Code:
    .glass_header_top{
    	float: left;
    	width: 932px;
    	height: 7px;
    	background-image: url("images/glass_header_top.png");
    	background-repeat: no-repeat;
    }
    .glass_header_mid{
    	padding-left: 7px;
    	float: left;
    	width: 932px;
    	height: auto;
    	background: 
    	url("images/glass_header_top_rep.png") top left no-repeat,
    	url("images/glass_header_top_rep2.png") bottom left no-repeat,
    	url("images/glass_header_mid.png") repeat-y;
    }
    .glass_header_bottom{
    	float: left;
    	width: 932px;
    	height: 7px;
    	background-image: url("images/glass_header_bottom.png");
    	background-repeat: no-repeat;
    }
    And here is how it's used:

    Code:
    <div class="glass_header_top">&nbsp;</div>
    <div class="glass_header_mid">&nbsp;</div>
    <div class="glass_header_bottom">&nbsp;</div>
    Because the rounded edges of the image I'm using for the corners of the content box, I had to slice the rest of the rounded corner and place it with the backrgound image which is where I get this code"

    Code:
    url("images/glass_header_top_rep.png") top left no-repeat,
    	url("images/glass_header_top_rep2.png") bottom left no-repeat,
    	url("images/glass_header_mid.png") repeat-y;
    Since my images are transparent, the top part of the extended rounded corner overlaps the original repeating background, causing two transparent images to overlap and create a less transparent image. Not good.

    Thanks


  •  

    Posting Permissions

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