Although not widely supported [96% supported in 2022], you can utilize the shape-outside
CSS declaration to achieve the desired effect:
Keep in mind this is just an example, not a definitive solution.
.element{
shape-outside: polygon(0 0, 0 100%, 100% 100%);
width: 20em;
height: 40em;
}
This will create a triangular region (three-sided polygon) where the text won't appear. A polyfill is available on Github for browsers lacking support for this feature.
There are several insightful articles online regarding shape-outside
, particularly on sites like HTML5 Rocks and A List Apart.
Additionally, there's a similar query on Stack Overflow from a couple of years back that might be helpful.
Edit: Added code snippet - the sample seems functional only in Chrome without the polyfill
.wrapper {
width: 300px;
}
.element {
shape-outside: polygon(0 0, 100px 0, 0 100px);
width: 100px;
height: 100px;
float:left;
}
<div class="wrapper">
<div class="element"></div>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
</div>