Si8
Si8

Reputation: 9235

How to have the cutout of a div at the bottom right with shadow to the left

Fiddle: https://jsfiddle.net/pj489c50/

HTML:

<div class="folded-corner-topright">
    <p>JUST ANOTHER TEXT</p>
</div>

How can I modify my CSS, so

Upvotes: 0

Views: 92

Answers (1)

Brett DeWoody
Brett DeWoody

Reputation: 62861

This should get you close. As a tip, I would separate your :before and :after selector properties so its more clear which rules are being applied to each.

html{
    height:100%;
}
body{
    height:100%;
    -moz-box-sizing:border-box;
    box-sizing:border-box;
    padding:20px;
    background: #FFF;
}
[class^="folded-corner-"]{
    color: #444;
    position:relative;
    width:350px;
    background:#E4E4E4;
    margin-bottom:10px;
    -webkit-box-shadow: 0px 0px 5px 0px rgba(0,0,0,0.3);
    -moz-box-shadow: 0px 0px 5px 0px rgba(0,0,0,0.3);
    box-shadow: 0px 0px 5px 0px rgba(0,0,0,0.3);
}
[class^="folded-corner-"],
[class^="folded-corner-"]:before{
    min-height:100px;
    right: 20px;
    -webkit-box-sizing:border-box;
    -moz-box-sizing:border-box;
    box-sizing:border-box;
}
[class^="folded-corner-"]:before,
[class^="folded-corner-"]:after{
    position:absolute;
    content:"";
    display:block;
    position:absolute;
    bottom:0;
    margin-right: 20px;
    width:0px;
    height:0px;
    box-sizing: border-box;
    border-style:solid;
}
[class^="folded-corner-"] p{
    padding:20px;
    color:#444;
    font-size:12px;
}


.folded-corner-topright:before{
    border-width:0px 0px 20px 20px;
    border-color:transparent transparent #d7d7d7 transparent;
    right: 0px;
}
.folded-corner-topright:after{
    right:-20px;
    border-width:20px 20px 0px 0px;
    border-color:#0099E7 #fff transparent transparent;
    box-shadow:3px 3px 2px 2px #FFF;
}
<div class="folded-corner-topright">
    <p>JUST ANOTHER TEXT</p>
</div>

Upvotes: 1

Related Questions