【问题标题】:Wordpress mobile devices logo resizeWordpress 移动设备徽标调整大小
【发布时间】:2014-12-30 14:31:05
【问题描述】:

您好,我遇到了一个小的媒体查询问题。我正在处理的网站上的徽标在移动设备上时不会调整大小。所以我试图添加下面的代码,但它没有做任何事情。有没有办法设置它以便它也可以在移动设备上运行?

链接: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;
    } 
}

【问题讨论】:

  • 它似乎可以在 Firefox 和 Chrome 中使用。
  • Chrome 允许您通过检查元素 devtool 中的“设备模式”在不同设备中查看您的页面。在检查元素部分,您可以在元素选项卡旁边看到一个“移动”图标。单击它时,将打开设备模式,您可以在左上角选择设备。我在 iPhone 6 plus 设备模式下使用此功能检查了您的页面,并且徽标正在根据您的媒体查询调整为 100 像素宽度。

标签: css media


【解决方案1】:

只需浏览您的网站链接,我就找到了 你的这个 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

【讨论】:

  • 好吧,我似乎在编辑器中找不到 responsive.css。我只有样式/自定义/rtl.css。有没有其他位置可以?非常感谢您的回复。
  • 只要去你的网站和页面源,你可以在第34行和第35行找到你的css,我找不到你的style/custome/rtl.css
  • 非常感谢Go先生的帮助,解决了问题。你只是节省了我几个小时。
  • 不客气,我需要一个帮助,你能不能接受我的回答对你有用,所以我得到了声望,我需要用图像问一个问题,我只需要1个声望,所以请
猜你喜欢
  • 1970-01-01
  • 2017-07-07
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-03-01
  • 2016-02-21
  • 1970-01-01
  • 2015-06-21
相关资源
最近更新 更多