It isn’t something I have to have, but I’ve been trying.
I have a page with h2 elements with div next siblings
What I would like to have, at least to see how it looks, is the linear-gradient sticking out a bit, and the border-radius bottom right corner ending at the div top right corner.
This is what I have right now, and if it is possible to do the alignment I’d like to remove the space between the h2 and div.
There are several divs and there are different children, p, ul, ol, dl.
I had thought to wrap the children with a div, but for some reason hadn’t thought to include the h2s and divs in another div. The closest I could get was by using magic numbers, which of course lost their magic at a mere wave of the wand.
Yeah, I had tried making it work with the html you posted (without the wrapping div).
The gradient offset (created by the h2 79.5% width + padding) became smaller and smaller when the viewport was reduced, to the point where it was barely noticeable at the smallest width.
Then there were also rounding errors where the round corner on the h2 was trying to line up with the div.
The wrapping div allows you to set a width one time, then the block children fill that space on their own.
My problem was I was “stuck” on styling the h2. Pseudo ::before doesn’t do linear-gradient. Different box-sizing values didn’t work. Trying different radii with ellipse didn’t work for lining up the border-radius. I was sure there must be a way that I just wasn’t thinking of. Negative margin “worked” but lost the auto which meant needing magic numbers. I was so focused on hammering that one nail I didn’t think to add another board to the crate