I'd like to have a simple div without any nested elements
<div class="border">čištění</div>
displaying horizontal dashed border inside the element (like within padding), like this

There is a outline-offset property, but it accepts only a single length value and vertical borders also appear. Is there any elegant solution?
In the suggested answer I can not see how to hide the vertical borders.
<!DOCTYPE html>
<html lang="en">
<head>
<title>Document</title>
<style>
.border {
display: flex;
align-items: center;
justify-content: center;
outline: 5px solid green;
outline-offset: -5px;
border-top: 10px dashed #fff;
border-bottom: 10px dashed #fff;
background-color: green;
color: white;
padding: 10px;
}
</style>
</head>
<body>
<div class="border">čištění</div>
</body>
</html>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With