中心3 div(一个宽度可变,两个宽度固定)在另一个div内

时间:2022-11-10 17:21:42

I am trying to achieve the following:

我想要实现以下目标:

Center 3 div tags within an outer fixed with div

中心3 div标签在外部固定div

Two of the inner div tags to be centered are of a fixed (the images on the left and right).

要居中的两个内部div标签是固定的(左侧和右侧的图像)。

One of the inner div tags (the one with text in the center) has a variable width. Note: I also need this text div to be vertically centered.

其中一个内部div标签(中间有文本的标签)具有可变宽度。注意:我还需要将此文本div垂直居中。

Here is what I am trying to achieve: http://uploadpic.org/storage/2011/hDGazBwWF2QHzGipwkyJ7ESsX.gif

这是我想要实现的目标:http://uploadpic.org/storage/2011/hDGazBwWF2QHzGipwkyJ7ESsX.gif

How can this be achieved? I have found answers to similar questions, but not exactly what I have described.

怎么能实现这一目标?我找到了类似问题的答案,但不完全是我所描述的。

Thanks!

谢谢!

1 个解决方案

#1


1  

Use vertical-align: middle. Here's a quick demo: http://jsbin.com/ujoket/1/edit

使用vertical-align:middle。这是一个快速演示:http://jsbin.com/ujoket/1/edit

#1


1  

Use vertical-align: middle. Here's a quick demo: http://jsbin.com/ujoket/1/edit

使用vertical-align:middle。这是一个快速演示:http://jsbin.com/ujoket/1/edit