2015-05-29 133 views
0

仍然在學習響應式網頁設計,遇到了一個障礙。水平對齊Tworesponsive圖像

有沒有辦法讓這兩個鏈接的圖像水平對齊,而不是在彼此之上,同時仍然保持響應? 基本上我需要這些圖像水平地在同一條線上,同時仍然響應。

最好每個圖像都有兩個div標籤嗎?或在一個單獨的div的兩個圖像?我不確定。

你可以看到我在做什麼jsfiddle

#header { 
padding-top: 1%; 
padding-bottom: .5%; 
background-color: white; 
} 
#header img { 
display: block; 
margin-left: auto; 
margin-right: auto; 
height: 20%; 
width: 20%; 
} 

回答

0

這裏的小提琴:https://jsfiddle.net/odw3vru8/8/

地址:

#header { 
    /* If you want to center align the images horizontally */ 
    text-align:center 
} 

#header img { 
    display: inline-block; 
    vertical-align:middle; 
}