同时设置两个方向的的圆角半径 此时的内容区为正方形
<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Document</title><style>div{width: 200px;height: 200px;background: black;position: absolute;left: calc(50% - 100px);top: 200px;border-top-left-radius: 200px 200px;}</style></head><body><div></div></body></html>
效果如下图
当其为长方形时
<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Document</title><style>div{width: 200px;height: 100px;background: black;position: absolute;left: calc(50% - 100px);top: 200px;border-top-left-radius: 200px 200px;border-top-right-radius: 200px 200px;}</style></head><body><div></div></body></html>
效果如下图
简易方式设置
border-radius: 200px 0 200px 0 / 100px 0 100px 0;
参数 top top bottom bottom / left right right left
<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Document</title><style>div{width: 200px;height: 100px;background: black;position: absolute;left: calc(50% - 100px);top: 200px;border-radius: 200px 0 200px 0 / 100px 0 100px 0;/* top left *//* top right *//* bottom right*//* bottom left *//*参数 top top bottom bottom / left right right left*/}</style></head><body><div></div></body></html>
效果图
示例2
<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Document</title><style>div{width: 200px;height: 100px;background: black;position: absolute;left: calc(50% - 100px);top: 200px;border-radius: 200px 0 200px 0 / 200px 0 200px 0;/* top left *//* top right *//* bottom right*//* bottom left */}</style></head><body><div></div></body></html>
效果图如下
index.html //border拓展
实现效果如下
