html - 在 div 中添加部分背景
解决方案
您没有编写任何有问题的代码。所以我现在编写示例 Html 和 CSS 代码。我希望这段代码能解决你的问题。
body{
background-color: #e3e3e3;
}
.bg-container{
background-image: url("https://i.stack.imgur.com/Q9aDy.jpg");
width:250px;
height: 250px;
background-color: #fff;
background-repeat: no-repeat;
background-size: 200px;
background-position: center center;
}
<div class="bg-container">
</div>
推荐阅读
- java - 在删除最后一个特殊字符的数据框 java 上应用函数或操作
- elasticsearch - ElasticSearch 按短语位置排序
- java - 使用 NamedParameterJdbcTemplate 在 sql 查询中将表名作为参数传递?
- python - 语音识别器在第一个声音输入时不起作用
- c# - AutoMapper c# 运行时映射取决于对象属性
- swift - Swift 空白应用
- java - 如何使用for循环增加字符串值?假设我的第一个值为“Project1”,然后我希望第二个值为“project2”,依此类推
- c# - 多个异步方法调用期间的异常处理不起作用
- javascript - 删除警报时,图像不会在 javascript 中调整大小
- vuepress - Vuepress 意外令牌