垂直对齐两个div,没有使用表格? [英] Vertical align two divs, w/o using tables?

查看:82
本文介绍了垂直对齐两个div,没有使用表格?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我有两个div,并排放置。 (我将第一个

div浮动到左边)我需要在这两个div上设置css,这样第二个

div与第一个垂直对齐一个(在中间)。关于这样做我怎么去?
?两个div都包含文本元素而且我不会轻易知道
知道高度,所以绝对定位是不对的。我也试过使用

垂直对齐选择器无济于事。我正试图在没有使用html表的情况下找到一种方式

,因为我知道我可以使用

那些很好的工作,但我正在尝试现在阻止这种心态,但如果是最好的方式,请告诉我!


谢谢,

- -Michael

Hi,

I''ve have two divs, that are laid out side-by-side. (I''m floating the first
div to the left) I need to set up css on these two divs so that the second
div is vertically aligned to the first one (in the middle). How can I go
about doing this?, both divs contain textual elements and I won''t easily
know the heights, so absolute positioning is out. I''ve also tried using the
vertical-align selector to no avail. I''m trying to find a way
without using an html table, because I know I can get it to work great with
those, but I''m trying to block that mentality right now, but if it is the
best way, please tell me!

Thanks,
--Michael

推荐答案

" Michael Ramey" < RA ***** @ spam.org>写道:
"Michael Ramey" <ra*****@spam.org> wrote:
我有两个div,并排放置。 (我将第一个
div浮动到左侧)我需要在这两个div上设置css,以便第二个div垂直对齐第一个(在中间)。我怎么能这样做呢?
I''ve have two divs, that are laid out side-by-side. (I''m floating the first
div to the left) I need to set up css on these two divs so that the second
div is vertically aligned to the first one (in the middle). How can I go
about doing this?




在这里工作正常,网址?


-

Spartanicus



Works fine here, url?

--
Spartanicus


" Michael Ramey" < RA ***** @ spam.org>写道:
"Michael Ramey" <ra*****@spam.org> wrote:
我有两个div,并排放置。 (我将第一个
div浮动到左侧)我需要在这两个div上设置css,以便第二个div垂直对齐第一个(在中间)。我怎么能这样做呢?
I''ve have two divs, that are laid out side-by-side. (I''m floating the first
div to the left) I need to set up css on these two divs so that the second
div is vertically aligned to the first one (in the middle). How can I go
about doing this?




在这里工作正常,网址?


-

Spartanicus



Works fine here, url?

--
Spartanicus


是的,这可能会有所帮助,我没有提到我在这些

两个div中有div。 > http://www.ncfunds.com/tnc.html


当你看到这个时,你会看到我的意思,右边的文字部分

与徽标部分垂直对齐在左边。 (所以文字不会出现

来自徽标的余额)。


谢谢,

- 迈克尔


" Spartanicus" < me@privacy.net>在留言中写道

新闻:e8 ******************************** @ news.spart anicus.utvinternet.ie ...
Yeah, that probably would help, I failed to mention I have divs inside these
two divs.

http://www.ncfunds.com/tnc.html

You''ll see what I mean when you look at this, vertically align the text part
on the right with the logo part on the left. (So the text won''t appear off
balance from the logo).

Thanks,
--Michael

"Spartanicus" <me@privacy.net> wrote in message
news:e8********************************@news.spart anicus.utvinternet.ie...
" Michael Ramey" < RA ***** @ spam.org>写道:
"Michael Ramey" <ra*****@spam.org> wrote:
我有两个div,并排放置。 (我将
firstdiv浮动到左边)我需要在这两个div上设置css,以便
seconddiv垂直对齐到第一个(在中间)。我怎么能这样做呢?
I''ve have two divs, that are laid out side-by-side. (I''m floating the firstdiv to the left) I need to set up css on these two divs so that the seconddiv is vertically aligned to the first one (in the middle). How can I go
about doing this?



在这里工作正常,网址?

-
Spartanicus



Works fine here, url?

--
Spartanicus



这篇关于垂直对齐两个div,没有使用表格?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆