I'm trying to add a custom text layout in a div by using shape-outside and clip-path. It does work as intended except one thing - parent height is not fixed so .my-div:before should automatically adapt to parent .my-div .
Is there a way to do it without using position:absolute on :before element? If I use position:absolute then text in .my-div ignores the shape. If I add fixed height to before element then overflow:hidden is ignored and fixed height might not fit the div.
Any suggestions?
.my-div {
width: 100%;
height: 100%;
text-align: justify;
position: relative;
overflow:hidden;
}
.my-div:before {
dispaly:block;
content:"";
float:right;
width: 200px;
height: 350px; <!-- want to get rid of that height, and somehow use 100% height of .my-div without using position:absolute; OR set height to large number but somehow hide everything what's higher than parent -->
background: #eee;
shape-outside: polygon(100% 0%, 83% 1%, 86% 9%, 91% 13%, 81% 20%, 87% 30%, 91% 37%, 82% 40%, 70% 48%, 85% 58%, 92% 64%, 81% 66%, 74% 71%, 87% 73%, 91% 82%, 84% 83%, 71% 89%, 89% 93%, 91% 99%, 100% 99%);
clip-path: polygon(100% 0%, 83% 1%, 86% 9%, 91% 13%, 81% 20%, 87% 30%, 91% 37%, 82% 40%, 70% 48%, 85% 58%, 92% 64%, 81% 66%, 74% 71%, 87% 73%, 91% 82%, 84% 83%, 71% 89%, 89% 93%, 91% 99%, 100% 99%);
}
