开发者

CSS image Size?

There...

#logoWrapper{
  background-image: url(../image/bg_img.jpg);
  height:86px;
  width:100%;
  }
开发者_开发问答

Q> How to fix the size of the image get into #logoWapper same with its Wapper automatically?

#logoWrapper img{       // not work
  height:86px;
  width:100%;
  } 

Thank you!


For a background image in CSS3 if you want to stretch not repeat you can use background-size: 100%;

Documented here http://webdesign.about.com/od/styleproperties/p/blspbgsize.htm

Alternatively you can layer a absolute positioned image inside a relative positioned div and add an additional wrapper.

<style>
#wrapper {
position:relative;
...
}
#wrapper div, #wrapper img {
position:absolute;
top:0px;
left:0px;
...
}
</style>

<div id="wrapper">
<img ... >
<div> this goes on top of image</div>
</div>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜