页面左边线要求一个半圆凹进去用css怎么写

html-css011

页面左边线要求一个半圆凹进去用css怎么写,第1张

不太明白你的意思,不过我根据我自己的理解,写了一个例子,如下图,如果是你想要的效果,就拿代码去用,如果不是,回复我一下,帮你调试!

html:

<div class="page">

    <div class="item"></div>

</div>

css:

.page{width: 600pxheight: 600pxborder: 2px solid #dddmargin: autoposition: relative}

.item{width: 200pxheight: 200pxoverflow: hiddenposition: absoluteright: 0top: 30%}

.item:before{width: 200pxheight: 200pxbackground: #23b7e5border-radius: 100%content: ""display: blockposition: absoluteleft: 50%}

<div>

    <p>Test</p>

</div>

<style>

div {

    width: 200px

    height: 200px

    background: #272727

    border: 1px #272727 solid

}

p {

    width: 158px

    line-height: 158px

    color: #fff

    text-align: center

    margin: 20px auto

    border-radius: 4px

    box-shadow: inset 0px 2px 8px 2px #000000

    border: 1px #666 solid

    border-left: 1px #131313 solid

    border-top: 1px #131313 solid

}

</style>

当圆角过大时深色边和高光边交界处会露陷,要不露陷的话:

边框渐变,貌似支持的浏览器少

不用边框,用两个div嵌套,外面那个比里面那个大1px,然后外面那个用45度的斜方向背景渐变(支持的浏览器多),里面那个用背景色加内阴影。