image in div wont show

て烟熏妆下的殇ゞ 提交于 2019-12-08 06:05:39

问题


Why wont it show the whole original picture?

<div class="test"></div>


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

Problem is that is doesnt 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.


回答1:


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;
}



回答2:


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.



来源:https://stackoverflow.com/questions/3352499/image-in-div-wont-show

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!