2014-10-17 62 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; (以它们为中心)。