473,395 Members | 1,694 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Is it possible to vertical align in a div?

Hi

See my mock-up at http://tinyurl.com/35tv29. The three icons are
supposed to be vertically aligned on their bottoms (using "vertical-
align: bottom"), but they aren't, they're vertically aligned on their
tops. Is there any way to align them vertically on their bottoms (or
middle for that matter) short of resorting to using a table (where
"vertical-align: bottom" does work)?

Dave
Mar 17 '08 #1
8 2799
On 2008-03-17, Dave Rado <da*******@dsl.pipex.comwrote:
Hi

See my mock-up at http://tinyurl.com/35tv29. The three icons are
supposed to be vertically aligned on their bottoms (using "vertical-
align: bottom"), but they aren't, they're vertically aligned on their
tops. Is there any way to align them vertically on their bottoms (or
middle for that matter) short of resorting to using a table (where
"vertical-align: bottom" does work)?
Vertical-align doesn't apply to blocks (like divs).

But you can set it on the imgs inside the divs if you want. Or set img
to display: block which I think is more appropriate here.
Mar 17 '08 #2
Hi Ben

On 17 Mar, 17:09, Ben C <spams...@spam.eggswrote:
Vertical-align doesn't apply to blocks (like divs).

But you can set it on the imgs inside the divs if you want.
I tried your suggestion but must be doing something wrong. See my mock-
up at http://tinyurl.com/2qh2vy. Can you see what I'm doing wrong?

Or set img
to display: block which I think is more appropriate here.
I tried this suggestion as well but again, I must be doing something
wrong. See my mock-up at http://tinyurl.com/2rzobt. Can you see what
I'm doing wrong?

Perhaps I should explain that I am trying hard to understand the more
complex parts of css but am finding it a real culture shock, having
learnt my html in the early 90x, when everyone used tables, and then
moved away from web development for several years, and I am now having
to build a complex website and as I say am finding the change from
using tables for layout to using css a real culture shock and a huge
learning curve. I don't need convincing of the benefits of the change,
but I need lots of hand holding.

Dave
Mar 18 '08 #3
On 2008-03-18, Dave Rado <da*******@dsl.pipex.comwrote:
Hi Ben

On 17 Mar, 17:09, Ben C <spams...@spam.eggswrote:
>Vertical-align doesn't apply to blocks (like divs).

But you can set it on the imgs inside the divs if you want.

I tried your suggestion but must be doing something wrong. See my mock-
up at http://tinyurl.com/2qh2vy. Can you see what I'm doing wrong?

>Or set img
to display: block which I think is more appropriate here.

I tried this suggestion as well but again, I must be doing something
wrong. See my mock-up at http://tinyurl.com/2rzobt. Can you see what
I'm doing wrong?
You've got three different divs, two of which are absolutely positioned.

Vertical-align on the images is only going to align them if they're on
the same line, which means (at least) all in the same block box.
Perhaps I should explain that I am trying hard to understand the more
complex parts of css but am finding it a real culture shock, having
learnt my html in the early 90x, when everyone used tables, and then
moved away from web development for several years, and I am now having
to build a complex website and as I say am finding the change from
using tables for layout to using css a real culture shock and a huge
learning curve. I don't need convincing of the benefits of the change,
but I need lots of hand holding.
Best to say exactly what you are trying to do with the three images in
the first place from the top.
Mar 18 '08 #4
Dave Rado wrote:
>
I need to create a
div 607px wide that is horizontally centred on the page, which I've
managed to do successfully. Within this div I need to place three
icons, one at the left edge of the div, one at the right edge of the
div, and one centred within the div. I've also managed to do this
successfully, and I' posted a mock-up (which is at http://tinyurl.com/35tv29)
showing my code which did this. However, the three icons are top-
aligned within the div and top-aligned relative to each other, whereas
I need them to be bottom-aligned
They really only appear to be top aligned because the line heights are
stretched as needed to fit the inline image. Baseline is the default
alignment for images. If the line heights were equal, the baseline would
be the same for all and they'd be aligned as you want.

Except maybe in IE. It doesn't do well with changing line-height of
replaced elements.

--
Berg
Mar 18 '08 #5
HI Berg

On 18 Mar, 22:59, Bergamot <berga...@visi.comwrote:
They really only appear to be top aligned because the line heights are
stretched as needed to fit the inline image. Baseline is the default
alignment for images. If the line heights were equal, the baseline would
be the same for all and they'd be aligned as you want.

Except maybe in IE. It doesn't do well with changing line-height of
replaced elements.
It sounds like I should go back to using tables?

Dave
Mar 18 '08 #6
Hi dorayme

On 18 Mar, 22:59, dorayme <doraymeRidT...@optusnet.com.auwrote:
What made you think your http://tinyurl.com/2pjwwy was a mockup
of my suggestion above?

--
dorayme
Obviously I haven't understood your suggestion.

Dave
Mar 18 '08 #7
Hi dorayme

On 19 Mar, 01:49, dorayme <doraymeRidT...@optusnet.com.auwrote:
I have made up a page for you that may help you understand the
ideas here:

<http://netweaver.com.au/alt/inlineImages/rado_imagesOnALine.html>
Many thanks, I'll study that page soon. However, Ben's suggestion
worked for me, so although I'm sure yours would work just as well,
I'll go with what is already working.
(I think I did say to you ages ago that unless you are super keen
on a course of study in this business, you should just use tables
for where you are fussy with exact layouts. But I made the above
in case it helps you or anyone else)
I thought you only said it's okay to use tables for numbering,
including for heading numbering, and I've gone with your suggestion on
that. But for layout I thought tables were considered a no-no these
days? In any case with respect to my original query, Ben's suggestion
works great (and I'm sure yours does too, and I will study yours
shortly), and it does simplify the code compared with using a table.
But I have a similar but different problem which I've just posted
about in reply to Ben.

Dave
Mar 19 '08 #8
Hi dorayme

On 27 Mar, 23:02, dorayme <doraymeRidT...@optusnet.com.auwrote:
You might consider it revelatory to *not* require such complicated and
exact layout. Have you really taken your head out of the considerable
details you are involved with and really thought how you might deliver
your material in a much simple way without compromising what the end
user will truly benefit from?
I believe so. I hope that if you disagree, you will still be willing
to help me find solutions to specific problems that I post about.

Dave

Mar 28 '08 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: abracad | last post by:
Hi Is it possible to vertically align an image in the middle of a DIV of fixed height?
10
by: Markus Ernst | last post by:
Hi I have a strange problem with vertical-align. The case can be viewed at http://www.brainput.info/geschichte.html. HTML code: <div id="bild"><img src="geschichte.gif" width="274"...
1
by: Kenneth | last post by:
Okay, I've been scouring Google for hours looking for a solution to this problem, but as of yet I can't find one. XHTML Transitional seems to specify that I can no longer set a table's height to...
2
by: Eric Lindsay | last post by:
If I want to have the middle of an image vertically aligned with the middle of a heading (or several lines of heading), is there some particular way people would recommend? vertical-align: center...
4
by: shivas | last post by:
Hi, I am using vertical-align for a table row, but the Image and the text are not aligned properly. I don't what to align image in the img tag, rather in the row itself I want to align. I want...
3
by: autospanker | last post by:
Ladies and Gentleman, I have been having this problem that has been driving me insane. I have a website that when viewed in Firefox first, the content in the body area is pushed down. Then when...
3
by: acunnon | last post by:
I am trying to put together an login page my problem is getting the three items aligned to the middle verticaly without specifing a height to anything on the page. CSS html{ height:100%;...
8
by: ayamopamo | last post by:
Hi- I am trying to center a web page. It seems like this should be very simple to do, but apparently it isn't my day. I have successfully centered the background by calling it in the css body tag:...
40
by: maya | last post by:
hi, how do I get text to vertical-align inside a div? http://www.mayacove.com/misc/home.html vertical-align should work, according to this:...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.