css中 media的用法,如何在css中正确使用@media

如何在css中使用@media作为特定分辨率?所以我想让我的侧栏更改取决于用户分辨率,所以我使用@media。如何在css中正确使用@media

这是示例代码:

@media (max-width: 1920px) and (min-width: 1080px){ /*for 1920 x 1080*/

.logo1{

margin-top: 70%;

}

.socmed a:nth-child(1), .socmed a:nth-child(2){

margin-top: 100%;

}

}

@media (max-width: 1680px) and (min-width: 1050px){ /*for 1680 x 1050*/

.logo1{

margin-top: 70%;

}

.socmed a:nth-child(1), .socmed a:nth-child(2){

margin-top: 90%;

}

}

@media (max-width: 1600px) and (min-width: 900px){ /*for 1600 x 900*/

.logo1{

margin-top: 50%;

}

.socmed a:nth-child(1), .socmed a:nth-child(2){

margin-top: 40%;

}

}

@media (max-width: 1440px) and (min-width: 900px){ /*for 1440 x 900*/

.logo1{

margin-top: 40%;

}

.socmed a:nth-child(1), .socmed a:nth-child(2){

margin-top: 50%;

}

}

@media (max-width: 1400px) and (min-width: 1050px){ /*for 1400 x 1050*/

.logo1{

margin-top: 70%;

}

.socmed a:nth-child(1), .socmed a:nth-child(2){

margin-top: 90%;

}

}

@media (max-width: 1366px) and (min-width:768px){ /*for 1366 x 768 until 1024 x 768*/

.socmed a:nth-child(1), .socmed a:nth-child(2){

margin-top: 20%;

}

}

这些代码,我把用途分辨率的评论,它工作得很好,直到我从1366×768打开我的网站和波纹管,它是覆盖与@media (max-width: 1400px) and (min-width: 1050px)。我如何防止这个问题呢?谢谢

2017-03-16

Rian

+0

您错误地使用了宽度和高度。 –

+0

噢,我的上帝,所以我应该使用最小宽度和最小高度? @Roberrrt –

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值