开发者

Image in div not shown [duplicate]

开发者 https://www.devze.com 2023-01-09 00:11 出处:网络
This question already has answers here: Fit background image to div (8 answers) Closed 2 years ago. Why won\'t it show the whole original picture?
This question already has answers here: Fit background image to div (8 answers) Closed 2 years ago.

Why won't it show the whole original picture?

.test {
  b开发者_Python百科ackground: url("http://i27.tinypic.com/28ktoh.jpg") no-repeat;
}
<div class="test"></div>

Problem is that is doesn't show anything, if you type something in the div it shows a little bit of the image. I want it to include the full picture.


Here is the working demo

You need to specify the height

.test { 
  background: url("http://i27.tinypic.com/28ktoh.jpg") no-repeat;
  overflow:auto;
  height:500px;
}


Set the height of the div. The div will not be higher than you tell it to be or higher than it needs to be.

0

精彩评论

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