CSS corners and background

Discussion in 'CSS' started by vlad230, Feb 25, 2009.

  1. #1
    hi guys!

    I need to make a rounded corner "box" which can be assigned variable height depending of the text that will be in the box.

    So, I have created 2 images: a top and a bottom image that are both 125 px high (the have to be that high because the box background is a gradient ) and have 4 rounded corners.

    this is the css code that I have used:
    #boxinpage{float: left; display: inline; width: 580px; margin-left: 5px; margin-top: 10px; }
    
    .container-1 {
            background: #f3f3f3 url(images/bg/reviews/top.gif) top no-repeat;
    
        }
    
    .container-2 {
            background: url(images/bg/reviews/bottom.gif) bottom no-repeat;
        }
    .container-3 {
    		padding: 23px 5px 10px 5px;
    		
        }
    Code (markup):
    and this is the html:
    
    <div id="boxinpage">
    		<div class="container-1">
    			<div class="container-2">
    				<div class="container-3">
    
                                    Content goes here....
    
                                    </div>
                            </div>
                     </div>
    </div>
    
    Code (markup):
    The problem is that the default background color that will have to fill the space between the two images is also appearing under the rounded corners and it looks horrible!

    Could anyone tell me how could I make the background color to appear with some 10px lower from the top and bottom such that the corners will look ok?

    Please take a look at the attached picture to know what I'm talking about :)

    P.S. link to image: http://carconcepts.us/forum.jpg

    Thanks,
    Vlad
     
    vlad230, Feb 25, 2009 IP
  2. MaxZ

    MaxZ Peon

    Messages:
    38
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    I've an headache, I can't think to much now but ...

    Did you removed the background from the image? ;/
    Also I see those are gif, do , save for web and hit Transparency, it should work ok.

    Also, this might be a problem

    background: #f3f3f3 url(images/bg/reviews/top.gif) top no-repeat;
    Code (markup):
    Just think a bit ;)

    My advice, change your method :)

    Oh, btw, Sal'tare
     
    MaxZ, Feb 25, 2009 IP
  3. dickieknee

    dickieknee Active Member

    Messages:
    441
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    80
    #3
    use a program such a lview pro, photoshop, paint shop pro to make the background transparent the format is gif89a
     
    dickieknee, Feb 25, 2009 IP
  4. vlad230

    vlad230 Active Member

    Messages:
    544
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    95
    #4
    You didn't understand me dudes... The images HAVE transparency but the problem is that the background color is showing up under the transparent corner...
     
    vlad230, Feb 25, 2009 IP
  5. vlad230

    vlad230 Active Member

    Messages:
    544
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    95
    #5
    I've updated the CSS code :
    
    .container-1 {
            background: url(images/bg/reviews/top.gif) top no-repeat;
    		padding: 23px 0px 0px 0px;
    
        }
    
    .container-2 {
            background: url(images/bg/reviews/bottom.gif) bottom no-repeat;
    		padding: 0px 5px 10px 5px;
        }
    .container-3 {
    		background: #f3f3f3;
    		
        }
    
    Code (markup):
    and the html:
    
    <div class="container-3">
    			<div class="container-1">
    				<div class="container-2">
                                    Content goes here...
                                    </div>
                            </div>
    </div>
    
    Code (markup):
    But I still get the same end result....

    PLEASE HELP
     
    vlad230, Feb 26, 2009 IP
  6. devnl

    devnl Guest

    Messages:
    31
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Isn't this exactly what transparency is supposed to do? If you don't want the color of container-3 to show underneath the transparent parts then don't set it.
     
    devnl, Feb 26, 2009 IP
  7. vlad230

    vlad230 Active Member

    Messages:
    544
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    95
    #7
    Please take a look here: http://carconcepts.us/forum.jpg

    I need to have the background color because that is the color that appears in the middle of the box and it allows the box to be stretched to X pixels.

    The problem is that I don't know how to keep it from appearing for about 10 px at the top and bottom such that the transparent corners allow the background (the black one) to be visible.
     
    vlad230, Feb 26, 2009 IP
  8. devnl

    devnl Guest

    Messages:
    31
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    What about this then?

    .container-1 {
            background-image: url(images/bg/reviews/top.gif);
            background-position: top;
            background-repeat: no-repeat;
            background-color: #f3f3f3;        
            padding: 23px 0px 0px 0px;
    }
    
    .container-2 {
            background-image: url(images/bg/reviews/bottom.gif);
            background-position: bottom;
            background-repeat: no-repeat;
            padding: 0px 5px 10px 5px;
            background-color: #f3f3f3;
    }
    .container-3 {}
    
    Code (markup):
     
    devnl, Feb 26, 2009 IP
  9. vlad230

    vlad230 Active Member

    Messages:
    544
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    95
    #9
    That doesn't work... :(
     
    vlad230, Feb 26, 2009 IP
  10. devnl

    devnl Guest

    Messages:
    31
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #10
    Do you have an example online we could look at?
     
    devnl, Feb 26, 2009 IP
  11. vlad230

    vlad230 Active Member

    Messages:
    544
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    95
    #11
    Sorry, I can't post the link.... Only the screen shot that I gave a link to....
     
    vlad230, Feb 26, 2009 IP
  12. vlad230

    vlad230 Active Member

    Messages:
    544
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    95
    #12
    Any more ideas guys?
     
    vlad230, Feb 26, 2009 IP