css局部边框创建'占位符'

Smu*_*ger 4 css border

使用CSS,如何根据下图创建部分边框

在此输入图像描述

我可以得到完整的边界:

border: 1px solid #f5f5f5; 
Run Code Online (Sandbox Code Playgroud)

但只想在顶部边缘显示可能30px而在垂直边框的底部没有任何东西?

这可以实现吗?

一如既往地谢谢,

Dae*_*ica 6

有一个CSS解决方案,但它很复杂,还需要HTML标记:

#box {
    width: 200px;
    height: 200px;
    margin: 30px;
    position: relative;
}

#box > div.corner {
    display: block;
    position: absolute;
    width: 50px;
    height: 50px;
}

.top {
    top: 0px;
    border-top-style: solid;
}

.bottom {
    bottom: 0px;
    border-bottom-style: solid;
}

.left {
    left: 0px;
    border-left-style: solid;
}

.right {
    right: 0px;
    border-right-style: solid;
}
Run Code Online (Sandbox Code Playgroud)
<div id="box">
    <div class="corner top left"></div>
    <div class="corner top right"></div>
    <div class="content">content</div>
    <div class="corner bottom left"></div>
    <div class="corner bottom right"></div>
</div>
Run Code Online (Sandbox Code Playgroud)

DEMO