我的 CSS 代码是:
.logo{
content:url(http://www.dylionsrugby.com.au/wp-content/uploads/2012/04/lion.png/600x600);
background-color: White;
float: right;
}
在 html 中我有:
<div class="logo"></div>
我是不是漏掉了什么,什么也没出现?`
最佳答案
你的问题有点笼统。您还可以在图像上而不是在 div 上使用定位属性来模拟正确的定位。
.logo{
width: 250px;
height: 75px;
background-image: url("http://www.slate.com/content/dam/slate/articles/health_and_science/science/2015/07/150730_SCI_Cecil_lion.jpg.CROP.promo-xlarge2.jpg");
background-color: white;
background-repeat: no-repeat;
background-size: 100% 100%;
float: right;
}
<div class="logo"></div>
关于html - 如何让带有白色背景图像的 div 向左浮动?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36730640/