css - DIV上半部椭圆布局问题?
伊谢尔伦
伊谢尔伦 2017-04-17 13:07:04
[HTML讨论组]

这种布局

自己试了下border-top-left/right-radius:50%,

但是差别很大,有没有什么好的纯html+css方案推荐?

伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

全部回复(5)
怪我咯

http://codepen.io/exdestroyer/pen/JXOVzL

怪我咯
    border-top-left-radius: 300px 50px;
    border-top-right-radius: 300px 50px;

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

PHPz
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>
        <p class="bg">
            <p class="decoration">

            </p>
            <p class="content">
                这里是内容
            </p>
        </p>
    </body>
</html>
PHP中文网

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

border-radius:20px/10px;

样子大概是这样

手机答的图片为手绘:->

PHP中文网

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

热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号