【问题标题】:background image size responzive design背景图片尺寸响应式设计
【发布时间】:2015-05-22 20:36:10
【问题描述】:

我正在为我的网站创建响应式设计。

我有一个这样的显示标志:

<h1><a href="http://example.com/">example.com</a></h1>

我在 CSS 中显示徽标:

#header h1{
margin-top:23px;
background: url(http://www.example.com/files/logo.jpg) no-repeat !important;
float: left;
text-indent: -9999px

}

我现在为移动访问者和响应式设计创建了一个新的 CSS 文件。

@media (max-width: 480px) { ...

如何根据用户手机/浏览器的宽度调整徽标的大小?我发现了 background-size 属性,但没有成功使用它。

谢谢

【问题讨论】:

    标签: html css mobile responsive-design


    【解决方案1】:

    试试

    header h1 { 
      background: url(http://www.example.com/files/logo.jpg) no-repeat center center fixed; 
      -webkit-background-size: cover;
      -moz-background-size: cover;
      -o-background-size: cover;
      background-size: cover;
    }
    

    【讨论】:

      猜你喜欢
      • 2018-11-14
      • 1970-01-01
      • 2013-05-19
      • 1970-01-01
      • 2012-12-16
      • 2012-12-13
      • 1970-01-01
      • 2023-04-11
      • 1970-01-01
      相关资源
      最近更新 更多