<div class="example1">サンプル1</div>
<div class="example2">サンプル2</div>
<div class="example3">サンプル3</div>
body {
padding: 10px 5%;
}
.example1,
.example2,
.example3 {
padding: 30px;
margin-bottom: 20px;
text-align: center;
position: relative;
}
/* example1 */
.example1::before {
content: "";
background-image: linear-gradient(to right, #000, #000 3px, transparent 3px, transparent 8px),
linear-gradient(to right, #000, #000 3px, transparent 3px, transparent 8px),
linear-gradient(to bottom, #000, #000 3px, transparent 3px, transparent 8px),
linear-gradient(to bottom, #000, #000 3px, transparent 3px, transparent 8px);
background-size: 8px 1px, 8px 1px, 1px 8px, 1px 8px;
background-position: left top, left bottom, left top, right top;
background-repeat: repeat-x, repeat-x, repeat-y, repeat-y;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
pointer-events: none;
}
/* example2 */
.example2::before {
content: "";
background-image: linear-gradient(to right, #000, #000 5px, transparent 5px, transparent 12px),
linear-gradient(to right, #000, #000 5px, transparent 5px, transparent 12px),
linear-gradient(to bottom, #000, #000 5px, transparent 5px, transparent 12px),
linear-gradient(to bottom, #000, #000 5px, transparent 5px, transparent 12px);
background-size: 12px 2px, 12px 2px, 2px 12px, 2px 12px;
background-position: left top, left bottom, left top, right top;
background-repeat: repeat-x, repeat-x, repeat-y, repeat-y;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
pointer-events: none;
}
/* example3 */
.example3::before {
content: "";
background-image: linear-gradient(to right, #000, #000 15px, transparent 15px, transparent 20px),
linear-gradient(to right, #000, #000 15px, transparent 15px, transparent 20px),
linear-gradient(to bottom, #000, #000 15px, transparent 15px, transparent 20px),
linear-gradient(to bottom, #000, #000 15px, transparent 15px, transparent 20px);
background-size: 20px 2px, 20px 2px, 2px 20px, 2px 20px;
background-position: left top, left bottom, left top, right top;
background-repeat: repeat-x, repeat-x, repeat-y, repeat-y;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
pointer-events: none;
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.