1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > css中 media的用法 如何在css中正确使用@media

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

时间:2021-05-22 03:57:01

相关推荐

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)。我如何防止这个问题呢?谢谢

-03-16

Rian

+0

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

+0

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

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。