我有一個圖像和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代碼示例基於引導結構