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
    Regular Coder cineweekly.com's Avatar
    Join Date
    Aug 2010
    Posts
    485
    Thanks
    14
    Thanked 3 Times in 3 Posts

    How do I get my CSS color background to extend with image?

    How can I make my background color for a specific class extend to the height of a containing image instead of stopping with the text? I'm trying to add images to the left of my news boxes as seen HERE. As you can see on the news boxes with grey backgrounds (or when hovered over) the background doesn't cover the image. I padded and added margins to the image but it didn't extend the color.

    I'm sure this is amateur stuff but I can't seem to figure it out. Thanks.
    Last edited by cineweekly.com; 12-09-2010 at 08:37 PM.

  • #2
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,749
    Thanks
    22
    Thanked 1,838 Times in 1,822 Posts
    Hello cineweekly.com,
    You need to clear your floats. Have a look at this page on how to clear floats using overflow: auto;


    Like this -
    Code:
    a p.newsA {
    	background-color: #E0E0E0;
    	color: #000;
    	padding: 0px 8px 0px 8px;
    overflow: auto;
    }
    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

  • Users who have thanked Excavator for this post:

    cineweekly.com (12-09-2010)

  • #3
    Regular Coder cineweekly.com's Avatar
    Join Date
    Aug 2010
    Posts
    485
    Thanks
    14
    Thanked 3 Times in 3 Posts
    Awesome thank you so much. I haven't came across overflow until now so it would have been a while until I found 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
    •