简体   繁体   English

WordPress标题图片没有响应

[英]Wordpress header image is not responsive

I am still trying to get the hang of responsive web design. 我仍在尝试使响应式Web设计变得一窍不通。

I am not able to get the header images to scale as the browser gets smaller. 随着浏览器变得越来越小,我无法缩放标题图像。

This is the site, 这是网站

http://instreamenergy.com/strategic-partnerships/ http://instreamenergy.com/strategic-partnerships/

if I try to make the .header-image #header #title-area height:100% or anything else it just reverts to 20px or something and is stuck there. 如果我尝试使.header-image #header#title-area height:100%或其他任何值,它只会恢复为20px或其他值,并停留在该位置。

Any tips would be awesome! 任何提示都很棒! thanks 谢谢

I think you're looking for the CSS3 property, background-size since your image is a background image for a DIV. 我认为您正在寻找CSS3属性, background-size因为您的图像是DIV的背景图像。

If you were using an image tag, <img> you could do this: 如果使用的是图像标签,请<img>可以执行以下操作:

img {
     max-width: 100%;
}

You also need to get rid of some of the cruft in your CSS for #title-area . 您还需要摆脱CSS中对#title-area Doesn't look like it needs to be floated: left; 看起来好像不需要floated: left; or have overflow: hidden; 或有overflow: hidden; . Removed width , changed height to min-height . 删除width ,将height更改为min-height no-repeat added to background . no-repeat添加到background

I would update it to: 我将其更新为:

#title-area {
     background: url(your-image.jpg) no-repeat;
     padding-left: 0;
     min-height: 386px;
     float: none;
     overflow: visible;
     background-size: 100% auto;
}

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

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