How to replicate this style

No description
19 Replies
Yas_!_ru
Yas_!_ru3mo ago
How can this be done is there a way to manipulate overflow to get this or pseduo elements that are placed in a certain way to clip off the image?
jwerre
jwerre3mo ago
Any image will overflow, just make sure you have overflow-x: hidden; and overflow-y: visible;
jwerre
jwerre3mo ago
MDN Web Docs
overflow - CSS: Cascading Style Sheets | MDN
The overflow CSS shorthand property sets the desired behavior when content does not fit in the parent element box (overflows) in the horizontal and/or vertical direction.
jwerre
jwerre3mo ago
Kevin Powell
YouTube
2 better alternatives to overflow: hidden
Looking to up your CSS Game? Free & Premium courses 👉 https://kevinpowell.co/courses?utm_campaign=general&utm_source=youtube&utm_medium=nomorehidden Overflow hidden is one of those features that seems like it should work in a very specific way, but it comes with a few strange side effects that can be incredibly frustrating and hard to fix. Th...
Yas_!_ru
Yas_!_ru3mo ago
I want the left and bottom sides of the image to be overflow hidden overflow-left overflow-right right does not exist
jwerre
jwerre3mo ago
Right, you'll need to clip the image itself in a raster based image editor (like Photoshop). you can't create a mask in CSS
Yas_!_ru
Yas_!_ru3mo ago
hmm it is easier
Yas_!_ru
Yas_!_ru3mo ago
MDN Web Docs
mask-clip - CSS: Cascading Style Sheets | MDN
The mask-clip CSS property determines the area which is affected by a mask. The painted content of an element must be restricted to this area.
Yas_!_ru
Yas_!_ru3mo ago
but the mask path needs to be closed prolly not worth the effort imma just crop the image
jwerre
jwerre3mo ago
ya, but there isn't full support for Edge and Safari It would be much more efficient to just clip the image before hand instead of asking the browser to create a complicated mask each time the image loads. Performance is definitely something to think about here.
Yas_!_ru
Yas_!_ru3mo ago
yeah imma go with that just wanted to see if there was a better way thanks for the help
ChooKing
ChooKing3mo ago
Getting the mask to be the right shape can be complicated. The much easier option is to erase the background on the image. You can do this in Photoshop or use one of the free online tools. When the background is replaced with transparency, this layout becomes very simple.
capt_uhu
capt_uhu3mo ago
the bottom left corner of the image or container element could be clipped with something like clip-path: inset(-90px 0 0 0 round 8px); this could be used to clip the right, bottom and left but clear enough room for the heads while maintaining the rounding. FYI as well, CSS mask was mostly cleaned up as part of Interop 2023. So if this is something that folks have been avoiding for compatibility reasons. That is not a huge concern anymore.
snxxwyy
snxxwyy3mo ago
Couldn’t you just clip the bottom left corner of the image to round it, and then use a pseudo element for the background?
capt_uhu
capt_uhu3mo ago
that always seems like a great idea in theory but in practice having 2 elements separately anti-aliasing a round corner almost never lines up well.
snxxwyy
snxxwyy2mo ago
Can you not use a variable with the border radius in and include it in the clip path url?
vince
vince2mo ago
I'm wondering too why you need clip-path? Can't you just set the border-bottom-left-radius to inherit or whatever the container is?
capt_uhu
capt_uhu2mo ago
I think part of the issue we are having here is not knowing what the original image the OP is using looks like. ie are we only clipping off part of the persons right arm or are we also clipping legs?
vince
vince2mo ago
good point