I’m trying to have the text appear in the corner, but it doesnt since i’m assuming the div is clipping that area. The big red square will have content eventually, but right now its empty since i want the text to appear before continuing. Anyway to get that going? Thanks
The extra semicolon from your first reply is due to SASS nesting. I did read thats it is only usable in chrome (clip-path). Your snippet of code is exactly what i am looking for. Thank you for your code and assistance. However, how could i get the same result if i wanted to use it in all modern browsers (Firefox, Chrome, Edge, etc.)
The question becomes one of choices. Which do you seek?
(1) that the angle of slope remain the same? In which case the height of the white space at the right will increase and decrease as the width of the page changes in viewports.
(2) that the height of the right end of the slope remain the same? In which case the angle of the slope will change as the width of the page changes. It will be steep at narrow widths; behavior like clip-path.
This uses a background image to create the sloping bottom. One could use an svg as @SamA74 recommended instead of the bg-image. This keeps the start and end heights of the sloped area the same but the angle of the slope becomes more acute at narrow widths. The height of the slope is the height of the background image so it is easily adjusted in CSS.
What about making the shape with a pseudo element instead of the extra markup or background image?
If there isn’t a browser bug I’m not aware of (afraid I’m not up to date yet) that affects manipulating a pseudo element instead like in the OP or your demos here.’
Thanks for posting the improved versions of my code. I tried to use ::after before I posted my versions with the tags and was unable to make it work. I was probably just tired and made an error and then couldn’t find it.
Looks like the z-index in your first example is unnecessary since the clip-path essentially removes that portion of the background. Doesn’t hurt anything, just not needed.
In the second example the negative z-index is likewise unnecessary and ::before seems to work better than ::after. The white overlay is on top of the red background and the text is above the white overlay. Using ::after, the text is beneath the white overly and needs z-index:1 to keep it from hiding beneath the white overlay.
I still don’t know why my attempts last night didn’t work, but they sure didn’t.