Enjoy unlimited access to all forum features for FREE! Optional upgrade available for extra perks.

caption box question

Discussion in 'Website Design' started by Reg Wharf, Oct 10, 2012.

Thread Status:
Not open for further replies.
  1. Reg Wharf United Kingdom

    Reg Wharf Active Member

    Joined:
    Jun 2009
    Posts:
    126
    Likes Received:
    3
    Hi Guys,
    I've added a translucent? caption box to an image on my website
    but I can't get it to appear at the bottom of the image, it keeps
    floating to the top no matter what padding/margins I use.
    The code I'm using is:

    CSS

    div.background{width:560px;height:112px;background:url(feeld2.jpg) repeat;}
    div.transbox{width:560px;height:20px;background:#000;opacity:0.5;filter:alpha(opacity=50);}
    div.transbox p{padding:1px 10px;color:#fff;}

    HTML

    <div class="background">
    <div class="transbox">
    <p>This is some text that is placed in the transparent box.</p>
    </div>
    </div>

    ta in advance for any help,
    cheers,
    Mark
     
  2. Tricky1 United Kingdom

    Tricky1 Active Member

    Joined:
    Nov 2008
    Posts:
    390
    Likes Received:
    37
    You could try adding top: 82px to the div.transbox or whatever pixels you require depending on how far you want it down.

    On my phone so can't check it but hopefully should work.
     
  3. seemly

    seemly Well-Known Member

    Joined:
    Feb 2011
    Posts:
    1,613
    Likes Received:
    497
    What happens if you try this?

    Code:
    div.background{width:560px;height:20px; padding-top:92px; background :url(feeld2.jpg) repeat;}
    div.transbox{width:560px;height:20px;background:#0 00;opacity:0.5;filter:alpha(opacity=50);}
    div.transbox p{padding:1px 10px;color:#fff;}
     
  4. Ashton Canada

    Ashton Well-Known Member

    Joined:
    Feb 2010
    Posts:
    1,566
    Likes Received:
    28
    Last edited: Oct 10, 2012
  5. Reg Wharf United Kingdom

    Reg Wharf Active Member

    Joined:
    Jun 2009
    Posts:
    126
    Likes Received:
    3
    You know what happens-it works perfectly!
    Thanks for the quick reply guys, problem solved.
    Tricky, you usually do it for me but I couldn't get it to work on this
    occasion (didn't know when you said top:82px whether or not you
    meant padding-top or margin-top) but knowing the codemaster you
    are I've probably done it wrong!
    Cheers,
    Mark.
     
  6. Reg Wharf United Kingdom

    Reg Wharf Active Member

    Joined:
    Jun 2009
    Posts:
    126
    Likes Received:
    3
Thread Status:
Not open for further replies.