【问题标题】:Image Placeholder with Percentages?带有百分比的图像占位符?
【发布时间】:2016-05-28 15:10:29
【问题描述】:

是否有办法使用带有百分比的占位符?
我知道有代码可以让您放置像素尺寸,但是百分比呢?占位符的代码是 img src="http://placehold.it/350x150"。我问是因为我想将线框放在一起,但我也希望它适合使用的任何屏幕。谢谢。

【问题讨论】:

    标签: html css image placeholder wireframe


    【解决方案1】:

    如果您使用占位符,那只是结束文件的尺寸,您可以使用 css 将大小更改为您想要的任何内容

    img{
     width:50%; /** Set to whatever you need **/
     height:auto; /** Retain image aspect ratio **/
    }
    

    可选

    添加 max-width,min-width / min-height, max-height 以获得更多控制权

    【讨论】:

    • 哦,哇。我认为这需要更多的时间,但我想这只是我再次过度分析事物。思考的事情比它们必须要复杂的多。谢谢。
    猜你喜欢
    • 2021-01-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-07-22
    • 2017-12-30
    • 1970-01-01
    • 1970-01-01
    • 2019-03-12
    相关资源
    最近更新 更多