【发布时间】:2016-05-28 15:10:29
【问题描述】:
是否有办法使用带有百分比的占位符?
我知道有代码可以让您放置像素尺寸,但是百分比呢?占位符的代码是 img src="http://placehold.it/350x150"。我问是因为我想将线框放在一起,但我也希望它适合使用的任何屏幕。谢谢。
【问题讨论】:
标签: html css image placeholder wireframe
是否有办法使用带有百分比的占位符?
我知道有代码可以让您放置像素尺寸,但是百分比呢?占位符的代码是 img src="http://placehold.it/350x150"。我问是因为我想将线框放在一起,但我也希望它适合使用的任何屏幕。谢谢。
【问题讨论】:
标签: html css image placeholder wireframe
如果您使用占位符,那只是结束文件的尺寸,您可以使用 css 将大小更改为您想要的任何内容
img{
width:50%; /** Set to whatever you need **/
height:auto; /** Retain image aspect ratio **/
}
可选
添加 max-width,min-width / min-height, max-height 以获得更多控制权
【讨论】: