2014-10-17 63 views
1

我忙於使用我的投資組合網站,並且我會讓它響應。從浮動:左右兩邊到彼此之間

大多數東西都是響應,但我正在努力與contact page

代碼:

.footerContact .informatie 
{ 
    float: left; 
    margin-left: 20%; 
    margin-top: 10%; 
    color: white; 
    width: 250px; 
} 

.footerContact .form 
{ 
    float: right; 
    margin-right: 20%; 
    margin-top: 10%; 
    color: white; 
    width: 300px; 
} 

我現在用一個媒體查詢將它們放在對方的時候去的屏幕尺寸較小爲1115px

例子可以發現here

哪有我做這個?

@media only screen and (max-width: 1115px) 
{ 
    .footerContact .informatie 
    { 
     float: none; 
     margin-left: 20%; 
     margin-top: 10%; 
     color: white; 
     width: 250px; 
    } 

    .footerContact .form 
    { 
     float: none; 
     margin-left: 20%; 
     margin-top: 100px; 
     color: white; 
     width: 250px; 
    } 

} 
+0

你看過[flexbox](http://css-tricks.com/snippets/css/a-guide-to-flexbox/)嗎? – 2014-10-17 08:16:51

回答

0

表單在響應模式下正常工作。

您只需將margin: auto設置爲居中對齊div。

小提琴:http://jsfiddle.net/L2mvewLo/1/

+0

謝謝!修復。 – 2014-10-17 09:10:12

+0

很高興聽到這一點,歡迎您! – emmanuel 2014-10-17 09:11:16

0

目標的所有設備 @media所有和(最大寬度:1115px){

然後要麼都設置到寬度:100%;和float:left;

或float:none;和margin:auto; (以它們爲中心)。