html - 图像未在 css 中加载
问题描述
我在 bootstrap/css 中有问题。我想从源文件夹加载图像,并在 css 中输入以下代码:
background: url('../img/home.jpg') no-repeat;
但它没有显示在页面上的我的主页部分。
解决方案
也许尝试
background-size: cover;
或者正如 ZohirSalak CeNa 所说,调整包含背景图像的元素的大小,除非它是你的身体。
HTML
<html>
<head>
<title>Your Title</title>
</head>
<body class="your-class">
</body>
</html
CSS
.your-class {
background-image: url('../img/home.jpg') no-repeat;
background-size: cover;
}
另外,请确保您有正确的图像路径
推荐阅读
- python - Python 代码不工作:TypeError,'int' object is not callable
- php - 我可以在不重复自己的情况下执行 SELECT 查询吗?
- python - 刽子手游戏,但我在使用列表功能时遇到问题
- powershell - 如何防止(序列化)表达式展开
- python - 查询用于将项目附加到列表的语法
- java - java - 如何将外部源代码传递给Java中的线程?
- bash - 创建一个目录并将文件移动到与模式匹配的目录中
- python - 删除熊猫单元格中的重复元素并计算元素数量
- aws-lambda - 如何让 Lambda 执行 DynamoDB 操作?
- ruby-on-rails - 如果帐户未在 Rails 中激活,则转到特定页面