Home > Article > Web Front-end > How to Create a Border Overlay for a Child Div with Pseudo Elements?
Creating a Border Overlay Child Div
To create a border overlay effect for a child div, you can consider utilizing pseudo elements. This approach offers several advantages:
Implementation Example:
body { background: grey; } .button { background: #94c120; width: 200px; height: 50px; margin: 50px; position: relative; } .button:before { content: ""; position: absolute; top: -15px; left: -15px; width: 100%; height: 100%; border: 5px solid #fff; box-sizing: border-box; }
<div class="button"> some text </div>
The above is the detailed content of How to Create a Border Overlay for a Child Div with Pseudo Elements?. For more information, please follow other related articles on the PHP Chinese website!