html - 我需要一只公鹿从底部变成一半红色,在顶部变成一半白色,但不是渐变的颜色机会。旁边有个黑圈
问题描述
我需要这头鹿在一个纯黑色圆圈内一半是红色,一半是白色,而且颜色机会不能是渐变的。我一直在对颜色使用线性渐变,但似乎也无法将它恰到好处地添加黑色圆圈作为背景,然后代码就会起火。
.heart-shape{
position: relative;
width: 200px;
height: 200px;
-webkit-transform: rotate(45deg);
-moz-transform: rotate(45deg);
-ms-transform: rotate(45deg);
-o-transform: rotate(45deg);
transform: rotate(45deg);
background-color: red;
}
.heart-shape:before,
.heart-shape:after{
position: absolute;
width: 200px;
height: 200px;
content: '';
-webkit-border-radius: 50%;
-moz-border-radius: 50%;
-o-border-radius: 50%;
border-radius: 50%;
background: repeating-linear-gradient(135deg,white ,white 20%,red 10px,red 25%);
}
#rcorners {
border-radius: 100px;
background: black;
padding: 20px;
width: 150px;
height: 150px;
}
.heart-shape:before{
bottom: 0px;
left: -100px;
}
.heart-shape:after{
top: -100px;
right: 0px;
}
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<br><br><br><br><br>
<div style="display: block;margin-left: auto;margin-right: auto;" class="heart-shape"></div>
</body>
</html>
解决方案
推荐阅读
- r - 将多个排他二元变量(列)合并到一个单因子列中
- mysql - 为什么我的中间端节点服务器在连接到数据库后停止运行
- javascript - 赛普拉斯:如何处理从 iframe 触发的窗口确认关闭
- python - 为基于 NaN 的列创建 IF 语句
- c++ - 线程安全的“漂亮计数器”(又名“施瓦茨计数器”)
- javascript - React - 将值传递给 setState 回调
- excel - VBA 宏 - 打开工作簿,设置活动,删除列
- ansible - Ansible:Blockinfile 对它可以创建的文件大小有限制吗?
- javascript - Swiper js幻灯片计数器
- python - 为数据类型集成异常处理