dashed border

by beebul

HTML

<div class="box">
     <h1>Apple Pie</h1>

    <p>Is it possible to do a design like this (the bordered edges) without using images, but using CSS only..?</p>
</div>

CSS

.box {
    position:relative;
    margin:2em auto 0;
    z-index:1;
    width:19em;
    color:gray;
}
h1 {
    color:red;
}
.box:after {
    background:#fdfdfd;
    content:" ";
    position:absolute;
    z-index:-1;
    top:-.5em;
    left:-.5em;
    width:19em;
    height:19em;
}
.box:before {
    position:absolute;
    z-index:-2;
    top:-1em;
    left:-1em;
    width:20em;
    height:20em;
    background:#000;
    content:" ";
    background-color:#f1f1f1;
    background-image: linear-gradient(transparent, transparent 1px), linear-gradient(transparent 1px, transparent 2px), linear-gradient(rgba(0, 0, 0, .3) 2px, transparent 1px), linear-gradient(90deg, rgba(0, 0, 0, .3) 2px, transparent 1px);
    background-size:100px 100px, 100px 100px, 20px 20px, 20px 20px;
    background-position:-1px -1px, -1px -1px, -1px -1px, -1px -1px;
}