This is a discussion on "align text to bottom of div?" within the Web Page Design section. This forum, and the thread "align text to bottom of div? are both part of the Design Your Website category.
|
|
|
|
|
![]() |
||
align text to bottom of div?
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
#1
|
|||
|
|||
|
is there a way to align my text to the bottom of a div? I am working on my first site and want to do it without tables. If I use tables I can get the results I want. If I use a div I can get what I want but only after some tweaking, is there a more simple approach? I have other divs with a similar layout but with 'special' fonts. I used .gifs with the font for those divs as not everyone will have this font installed. Because I had to use an image for the font that means they are a set dimension and layout. I want the layout to be consistant between divs that use CSS for the text and .gifs for the text.
This is initially what the div produces: ![]() This is after my tweaks: ![]() I set the line height and used padding to push the text down. The .gif with the 'special' is 25px in height so I need these new divs to be the same. I believe I recreated that with line-height & padding-top, 16px + 9px = 25px, hopefully. Is this a good way to go about positioning the text?
|
|
|
|
#2
|
|||
|
|||
|
Re: align text to bottom of div?
You could apply the css style attribute 'vertical-align' to your divs in question.
There are a number of values you could give it, try them and see which you prefer. They are; bottom, text-bottom and baseline. |
|
#3
|
|||
|
|||
|
Re: align text to bottom of div?
bottom;
text-bottom; and baseline do not work. the text is either floating at the top of the div or in the middle. I am using Dreamweaver 8, I don't know if this helps but I thought I should toss it out. |
|
#4
|
|||
|
|||
|
Re: align text to bottom of div?
Are you giving the dvis an actual height and what is the size of the gifs?
|
|
#5
|
|||
|
|||
|
Re: align text to bottom of div?
The div that I am trying to format the text to the bottom does have a height and width set through its class. The .gif images are 150px(w) by 25px(h).
I don't know if it has anything to do with Dreamweaver 8 but I've tried to do my layout out a number of ways. The first time was almost all tables. Vertical align worked fine in the table cells. Then I recently did a layout trying to solve my current problem using all divs, but I inserted a single cell table into the div with the same code copied from my previous version used for the cell, it did not format like the layout with all the tables. Then I removed the copied code and hand-coded it, then it worked. Would this have to do with some setting in Dreamweaver 8? Also, does it matter if the div I'm working on is a nested div? |
|
#6
|
|||
|
|||
|
Re: align text to bottom of div?
It shoudn't matter at all that your div is a nested div. I note from your css above that your div is the same height and width as your gifs so any attempt at alignment is pointless as both the container and the contained item are the same size. Or have I missed understood something along the way? |
|
#7
|
|||
|
|||
|
Re: align text to bottom of div?
I have two divs. One with a gif with a font that is not common, that's why I am displaying it with an image. The other is with a common font and I am working on displaying it so it is consistant with the image. Using vertical-align; and other properties have not worked. I've tried defining the second div, the one with common text with CSS possitioning and styles, but is not working. I done it by defining the height and width and without. It just doesn't want to set on the bottom.
|
|
#8
|
|||
|
|||
|
Re: align text to bottom of div?
Post a link so we can see the actual page. It's much easier to see what is happening and posibly tweak it as well. |
|
#9
|
||||
|
||||
|
Re: align text to bottom of div?
I don't completely understand your post. Vertical-align seems buggy to me, but if you want to try it, understand that it applies to in-line elements.
If you put the text in a containing div at the end of the primary div, and set height of both div's to auto, the text should bottom-align automatically. If you need a bigger box for the containing div, just use padding and leave the size on auto. You don't even have to put the graphic in a containing div, as a graphic is a box element per se and will take styling, so you can increase the box height and manipulate graphic placement using padding and/or margins. If you set a height, you are going to get all kinds of cross-browser problems. Even among current browsers, where css1 support is pretty good (so that margins and padding will accrue to the box height), Firefox text settings will change text-size set in pixels, but IE won't. Last edited by masonbarge; Aug 5th, 2006 at 13:20. |
|
#10
|
|||
|
|||
|
Re: align text to bottom of div?
Quote:
jaredthompson.net/divs.html |
![]() |
| Tags |
| align, text, bottom, div |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Align text vertically in a box | josoap | Web Page Design | 3 | Jul 12th, 2007 17:29 |
| Text-Align | Marc | Web Page Design | 11 | Jun 1st, 2007 07:22 |
| Vertical Align to Bottom | tox0tes | Web Page Design | 7 | Jan 16th, 2007 15:36 |
| Text running from top to bottom - How? | rubyfruit | Web Page Design | 12 | Oct 2nd, 2006 11:21 |
| help with text-align: center | iemerick | Web Page Design | 1 | Jun 9th, 2005 18:05 |