您好,我遇到了一个小的媒体查询问题。我正在使用的网站上的 Logo 在移动设备上不会调整大小。所以我尝试添加下面的代码,但它什么也没做。有没有办法设置它以便它也可以在移动设备上工作?
链接:http://eyeandretina.com.au/
.header_left a img
{
float: left;
margin-right: 20px;
width:612px;
}
media {
/* Smartphones (portrait and landscape) ----------- */
@media only screen
and (min-device-width : 320px)
and (max-device-width : 480px) {
.header_left a img {
width:100px;
}
/* Smartphones (landscape) ----------- */
@media only screen
and (min-width : 321px) {
/* Styles */ .header_left a img {
width:100px;
}
}
/* Smartphones (portrait) ----------- */
@media only screen
and (max-width : 320px) {
/* Styles */ .header_left a img {
width:100px;
}
}
/* iPads (portrait and landscape) ----------- */
@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px) {
/* Styles */ .header_left a img {
width:100%;
}
}
/* iPads (landscape) ----------- */
@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px)
and (orientation : landscape) {
/* Styles */ .header_left a img {
width:100%;
}
}
/* iPads (portrait) ----------- */
@media only screen
and (min-device-width : 768px)
and (max-device-width : 1024px)
and (orientation : portrait) {
/* Styles */ .header_left a img {
width:100px;
}
}
/* Desktops and laptops ----------- */
@media only screen
and (min-width : 1224px) {
/* Styles */ .header_left a img {
width:100%;
}
}
/* Large screens ----------- */
@media only screen
and (min-width : 1824px) {
/* Styles */ .header_left a img {
width:100px;
}
}
/* iPhone 4 ----------- */
@media
only screen and (-webkit-min-device-pixel-ratio : 1.5),
only screen and (min-device-pixel-ratio : 1.5) {
/* Styles */
.header_left a img {
width:100px;
}
}
最佳答案
只是通过你的网站链接,我发现 你的这个 css 没有调用
http://eyeandretina.com.au/wp-content/themes/medicenter/style/responsive.css?ver=4.1
此 css 将覆盖您当前的 css。
尝试在这个 responsive.css 中完成所有代码,或者优先考虑 style.css
http://eyeandretina.com.au/wp-content/themes/medicenter/style.css?ver=4.1
关于css - Wordpress 移动设备 Logo 调整大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27700490/