User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the HTML and CSS section within the Web Development category of DaniWeb, a massive community of 391,971 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,157 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our HTML and CSS advertiser: Lunarpages Web Hosting
Views: 4342 | Replies: 3
Reply
Join Date: Dec 2007
Posts: 2
Reputation: kezia_kristina is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
kezia_kristina kezia_kristina is offline Offline
Newbie Poster

Setting text vertical align to bottom in div tag

  #1  
Mar 23rd, 2008
Hi all,
I want to set the text on the right side of image to bottom in a div tag.
depict like below:

______
| img |
| |
|_____| The text is here at the bottom of Image

But after trying some CSS code (using 'vertical-align:bottom'), I always got something like below (there is aways a padding on the bottom, even I set the padding-bottom to zero):
______
| img |
| | The text is here at the bottom of Image
|_____|

Here my code:

  1. <div class='title'>
  2. <div class='date'>
  3. <!-- the image is a background of this 'div' -->
  4. </div>
  5. <h2 id='header2'>
  6. The text is here at the bottom of Image
  7. </h2>
  8. </div>
  9.  
  10.  
  11. .title {
  12. padding:0 0 0 0;
  13. vertical-align:bottom;
  14. height:56px;
  15. }
  16.  
  17. .date
  18. {
  19. float:left; width:59px; height:56px; overflow:hidden;
  20. text-align:center;
  21. background: url("someurlHere/icon.jpg") no-repeat;
  22. }
  23.  
  24. #header2 {
  25. vertical-align:bottom;
  26. padding-bottom:0;
  27. }
Anyone can help me?
Last edited by peter_budo : Mar 24th, 2008 at 5:00 am. Reason: [icode]is for one line of code, [code] is for multiple lines
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jan 2008
Location: Bali - Indonesia
Posts: 61
Reputation: rudevils is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 7
rudevils rudevils is offline Offline
Junior Poster in Training

Re: Setting text vertical align to bottom in div tag

  #2  
Mar 23rd, 2008
Originally Posted by kezia_kristina View Post
#header2 {
vertical-align:bottom;
padding-bottom:0;
}
Anyone can help me?


try this

  1. #header2 {
  2. vertical-align:bottom;
  3. padding-bottom:0;
  4. float: left;
  5. }
Last edited by peter_budo : Mar 24th, 2008 at 5:00 am. Reason: Keep It Organized - please use [code] tags
If love is blind, why there's a bikini ??

Post your article at Bali Side Notes share your knowledge
Reply With Quote  
Join Date: Dec 2007
Posts: 2
Reputation: kezia_kristina is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
kezia_kristina kezia_kristina is offline Offline
Newbie Poster

Re: Setting text vertical align to bottom in div tag

  #3  
Mar 23rd, 2008
No, it didn't work
Reply With Quote  
Join Date: Jan 2008
Location: Bali - Indonesia
Posts: 61
Reputation: rudevils is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 7
rudevils rudevils is offline Offline
Junior Poster in Training

Re: Setting text vertical align to bottom in div tag

  #4  
Mar 24th, 2008
sorry i didn't see height attribute in your ".title"
try it like this :

.title {
padding:0 0 0 0;
text-align: left;
}

.date {
width:59px; height:56px; overflow:hidden;
text-align:center; 
background: url("someurlHere/icon.jpg") no-repeat;
}

#header2 {
padding:0;
margin:0;
}
If love is blind, why there's a bikini ??

Post your article at Bali Side Notes share your knowledge
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb HTML and CSS Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the HTML and CSS Forum

All times are GMT -4. The time now is 9:23 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC