I am currently working on a project that requires a unique CSS effect:
Let me explain exactly what I am trying to achieve:
The main element (referred to as the title
) has padding and a 2px bottom border. Inside this, there is a child element (known as title-inner
) which also has padding and a 2px border but in a different color, creating an overlapping effect with its parent (title
).
This is the structure I am using:
<div class="title">
<div class="title-inner">Widget title</div>
</div>
I understand that achieving this effect will require adjusting the padding and margin properties of both elements, however, the CSS I have written so far does not respond well on mobile or when resizing the browser window (you can see it in action here: this fiddle).
Is there a more effective way to accomplish this CSS effect? Any suggestions?