简体   繁体   English

移动屏幕时标题图像正在关闭

[英]The header image is closing up when mobile screen

I'm making a webpage for my own business . 我正在为自己的公司制作网页。 I chose Bootstrap because it comes mobile-capable out of the box. 我选择Bootstrap是因为它具有移动功能。 I'm having a problem: 我有一个问题:

  • When accessing the webpage using a phone (iPhone 5) the header image does a close up, zooming in with no proportions. 当使用电话(iPhone 5)访问网页时,标题图像会关闭,没有比例放大。

Here is the code: 这是代码:

#heading {
  display: block;
  width: 100%;
  height: 543px;     
  background: url('../images/header.jpg') no-repeat center center fixed; 
  -webkit-background-size: cover;
  -moz-background-size: cover;
  -o-background-size: cover;
  background-size: cover;
  -webkit-box-shadow: inset 0 -4px 9px -3px #000;
  -moz-box-shadow: inset 0 -4px 9px -3px #000;
  box-shadow: inset 0 -4px 9px -3px #000;
}

@media(max-width:563px) {
  #heading {
    display: block;
    width: 100%;
    height: 300px;         
    background: url('../images/headerm.jpg') no-repeat center center fixed; 
  }
  #navigation .navlinks li {
    margin-right: 1px;
  }
  #navigation .navlinks li a {
    padding: 0 5px;
    font-size: 12px;
  }

}

I tried using a different size image for the media query, but it didn't work. 我尝试对媒体查询使用其他大小的图像,但是没有用。

Here is the link for testing scenario. 是测试方案的链接。 If you shrinks your browser to simulate phone screen, the image doesn't do the close up. 如果缩小浏览器以模拟手机屏幕,则图像不会关闭。 It has to be on a phone. 它必须在电话上。

@media(max-width:563px) {
  #heading {
    display: block;
    width: 100%;
    height: 300px;         
    background: url('../images/headerm.jpg') no-repeat center center scroll; 
    -webkit-background-size: 100% auto;
    -moz-background-size: 100% auto;
    -o-background-size: 100% auto;
    background-size: 100% auto;
  }
}

Should work. 应该管用。 Change fixed to scroll. 更改为固定滚动。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM