css - CSS 边框半径简写
问题描述
我有这个CSS代码:
border-radius: 50%/15px;
border-top-left-radius: 10px;
border-top-right-radius: 10px;
我正在尝试在单个border-radius
属性中编写代码,但没有任何运气。可能吗 ?
解决方案
它应该是border-radius: 10px 10px 50% 50% / 10px 10px 15px 15px;
请参阅https://developer.mozilla.org/de/docs/Web/CSS/border-radius
#shorthand {
border-radius: 10px 10px 50% 50% / 10px 10px 15px 15px;
/*
It's follwing order 1 2 3 4 / 5 6 7 8
1: horizontal top left
2: horizontal top right
3: horizontal bottom right
4: horizontal bottom left
5: vertical top left
6: vertical top right
7: vertical bottom right
8: vertical bottom left
That means starting from top left clockwise, before the slash horizontal and after the slash vertical
*/
}
#original, #shorthand {
border-color: silver;
border-width: 1px;
width: 161px;
height: 100px;
background-color: goldenrod;
margin: 20px;
float: left;
display: flex;
align-items: center;
justify-content: center;
}
#original {
border-radius: 50%/15px;
border-top-left-radius: 10px;
border-top-right-radius: 10px;
}
<div id="original">Original</div>
<div id="shorthand">Shorthand</div>
您可以在这里查看示例:https ://codepen.io/HerrSerker/pen/BGJyKv?editors=0100
推荐阅读
- javascript - 如何在一行中 console.log 对象
- node.js - 不能在邮递员中输入错误..我可以知道是什么错误..我在邮递中没有问题并获得请求
- java - 如何创建 JButton 的 JList?
- javascript - 用于突出显示单词的 jQuery 自动完成正则表达式
- flutter - 用颤振堆叠
- javascript - Angular:如何“保存”“对象”?
- angularjs - AngularJS Ng-Repeat不在数组中显示数据
- c++ - 为什么堆栈展开后程序无法到达正确的返回指令?
- javascript - React 复选框控制组件
- opengl - ShadowMap 渲染的阴影计算问题