我有一个图像和div内的一些文本,我想将图像和文本div放在行div的垂直中心使用CSS。问题是我不知道我会有多少行文字,但文字和图像必须始终在中间。例如,如果只有一个行文本的DIV应该是这样的:如何使用CSS在引导程序中将文本div垂直居中放置在图像div旁边?
####################################
# _______ #
# | | #
# | | #
# | IMAGE | text text text #
# | | #
# |_______| #
# #
####################################
and if more than one lines than it should looking like this:
####################################
# #
# text text text #
# _______ text text text #
# | | text text text #
# | | text text text #
# | IMAGE | text text text #
# | | text text text #
# |_______| text text text #
# text text text #
# text text text #
# #
####################################
在这里,我有这的jsfiddle是我的代码,我想解决在连接捣鼓这个问题。
的jsfiddle:https://jsfiddle.net/vh3ewa54/
注:此的jsfiddle代码示例基于引导结构