background-image 属性未在 css 中显示图像 [英] background-image property is not showing the image in css

查看:44
本文介绍了background-image 属性未在 css 中显示图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图放置背景图片,但没有显示.

.jumbotron{背景图片:url("/src/assets/shop1.png");背景尺寸:封面;}<div class="jumbotron">欢迎来到主页

解决方案

背景图片会看 div 的高度和宽度.请按照代码查看图像.

.jumbotron {背景图片:url('https://imgsv.imaging.nikon.com/lineup/dslr/df/img/sample/img_01.jpg');背景尺寸:100% 100%;高度:100px;宽度:100%;背景重复:不重复;}

工作演示

I was trying to put background image but it is not showing.

.jumbotron{
   background-image: url("/src/assets/shop1.png");
   background-size: cover;
}

<div class="jumbotron">
   Welcome to Home Page
</div>

解决方案

The background image will look at the height and width of the div. Please follow the code to see the image.

.jumbotron {
   background-image: url('https://imgsv.imaging.nikon.com/lineup/dslr/df/img/sample/img_01.jpg');
  background-size: 100% 100%;
  height: 100px;
  width: 100%;
  background-repeat: no-repeat;
}

Working demo

这篇关于background-image 属性未在 css 中显示图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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