在 CSS 中定义一个 <img> 的 src 属性 [英] Define an <img>'s src attribute in CSS

查看:22
本文介绍了在 CSS 中定义一个 <img> 的 src 属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在 CSS 中定义一个 <img> 的 src 属性.有没有办法指定这个属性?

I need to define an <img>'s src attribute in CSS. Is there a way to specify this attribute?

推荐答案

#divID {
    background-image: url("http://imageurlhere.com");
    background-repeat: no-repeat;
    width: auto; /*or your image's width*/
    height: auto; /*or your image's height*/
    margin: 0;
    padding: 0;
}

这篇关于在 CSS 中定义一个 &lt;img&gt; 的 src 属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆