DIV上半部椭圆布局问题?

这种布局
图片描述
自己试了下border-top-left/right-radius:50%,
图片描述
但是差别很大,有没有什么好的纯html+css方案推荐?

阅读 6k
5 个回答
    border-top-left-radius: 300px 50px;
    border-top-right-radius: 300px 50px;

//設置兩個值可以達到橢圓圓角的效果

position:relative;
toop:10rem;
height:4rem;

就能基本形似了;

更新答案:希望PO主不是伸手党;

<html>
    <style>
        .bg{
            background:blue;
            width:320px;
            height:100%;
            min-height:100%;
            max-height:100%;
            overflow:hidden;
            box-sizing: border-box;
            padding-top:5rem;
            position: relative;
            overflow:hidden;
        }
        .bg .content{
            display: block;
            padding:4rem 1rem 0;
            position: relative;
            z-index:2;
        }
        .bg .decoration{
            height:640px;
            width:640px;
            position: absolute;
            left:-160px;
            background:white;
            border-radius:50%;
            z-index:1;
            box-sizing: border-box;
        }
        .bg .decoration:before{
            display: block;
            content:"";
            margin:5px;
            height:626px;
            width:626px;
            border-radius:50%;
            border:2px dashed blue;
        }
    </style>
    <body>
        <div class="bg">
            <div class="decoration">

            </div>
            <div class="content">
                这里是内容
            </div>
        </div>
    </body>
</html>
新手上路,请多包涵

border-radius是可以设置水平半径和垂直半径的,格式为 水平/垂直 比如

border-radius:20px/10px;

样子大概是这样
Image
手机答的图片为手绘:->

好吧,我试了一下,发现实现起来有点困难,题主我只能告诉你background-color:rgb(50,40,80);还有一个是rgb(238,238,238);

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题