因此,我试图将此边框的顶部和左侧混合到背景中,即沿着边缘没有可见的线条。我使用border-shadow上的inset值来显示这些边缘融合,尽管边框似乎有一个可见的边缘。
请参阅代码段:
HTML:
<article class="para">
<h2> X-cessive Overview </h2>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam pretium lectus eget risus tempor eleifend. Nulla facilisi. Mauris non ultrices mi, in tristique enim. Nulla facilisi. Nullam dapibus consectetur eros, sed eleifend ligula tincidunt id. Curabitur non velit non elit volutpat accumsan iaculis id elit. Nullam quis tortor maximus, laoreet sapien id, gravida nibh. Nunc tempor justo gravida magna sodales euismod. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Morbi et diam suscipit, varius ante sagittis, bibendum dolor. Nunc pellentesque molestie.
</article>
CSS:
.main {
background-image: url(../images/backgrounds/exile-main1.png);
background-size: cover;
background-repeat: no-repeat;
width: 100%;
height: 400px;
color: #000;
border-bottom: 2px solid #939799;
}
.main h1 {
position: relative;
top: 40px;
left: 30px;
color: #424040;
font-size: 2em;
}
.para {
width: 33%;
border-right: 2px solid rgb(237,36,62);
border-bottom: 2px solid rgb(237,36,62);
border-top: 10px transparent;
border-left: 10px transparent;
padding: 15px;
position: relative;
left: 140px;
top: 110px;
font-size: 1em;
border-radius: 20px 20px 20px 20px;
box-shadow: 20px 20px 60px #fff inset;
background-color: #939799;
}
.para h2 {
font-size: 1.2em;
text-decoration: underline;
}
<article class="para">
<h2> X-cessive Overview </h2>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam pretium lectus eget risus tempor eleifend. Nulla facilisi. Mauris non ultrices mi, in tristique enim. Nulla facilisi. Nullam dapibus consectetur eros, sed eleifend ligula tincidunt id. Curabitur non velit non elit volutpat accumsan iaculis id elit. Nullam quis tortor maximus, laoreet sapien id, gravida nibh. Nunc tempor justo gravida magna sodales euismod. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Morbi et diam suscipit, varius ante sagittis, bibendum dolor. Nunc pellentesque molestie.
</article>
这是Screenshot,因此您可以更好地查看问题。
答案 0 :(得分:1)
您可以将box-shadow
上的.para
调整为:box-shadow: 45px 15px 70px #fff inset
如果文字需要在灰色顶部,请向.para
添加更多左边填充,例如:padding: 15px 15px 15px 40px;
.main {
background-image: url(../images/backgrounds/exile-main1.png);
background-size: cover;
background-repeat: no-repeat;
width: 100%;
height: 400px;
color: #000;
border-bottom: 2px solid #939799;
}
.main h1 {
position: relative;
top: 40px;
left: 30px;
color: #424040;
font-size: 2em;
}
.para {
width: 33%;
border-right: 2px solid rgb(237,36,62);
border-bottom: 2px solid rgb(237,36,62);
border-top: 10px transparent;
border-left: 10px transparent;
padding: 15px 15px 15px 46px; /* Adjust this */
position: relative;
left: 140px;
top: 110px;
font-size: 1em;
border-radius: 0 20px 20px 20px; /* Adjust this */
box-shadow: 45px 15px 70px #fff inset; /* Adjust this*/
background-color: #939799;
}
.para h2 {
font-size: 1.2em;
text-decoration: underline;
}
&#13;
<article class="para">
<h2> X-cessive Overview </h2>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam pretium lectus eget risus tempor eleifend. Nulla facilisi. Mauris non ultrices mi, in tristique enim. Nulla facilisi. Nullam dapibus consectetur eros, sed eleifend ligula tincidunt id. Curabitur non velit non elit volutpat accumsan iaculis id elit. Nullam quis tortor maximus, laoreet sapien id, gravida nibh. Nunc tempor justo gravida magna sodales euismod. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Morbi et diam suscipit, varius ante sagittis, bibendum dolor. Nunc pellentesque molestie.
</article>
&#13;