带有偏移量的 CSS div 边框
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5690252/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-30 00:17:36 来源:igfitidea点击:
CSS div border with offset
提问by Adrian Marinica
How can I make a div's side (left/right) border start lower than it's actual size? I know I can reduce it's height and then add a margin-top, but I don't want that. Is it possible to simply lower down the starting point of the border?
如何使 div 的侧边(左/右)边框开始时低于其实际大小?我知道我可以降低它的高度,然后添加一个边距顶部,但我不想要那样。是否可以简单地降低边界的起点?
__________
|
|
|
采纳答案by BoltClock
You can only do this by omitting the top border and either
你只能通过省略顶部边框来做到这一点,或者
- adding a top margin to the bottom element or
- adding a bottom margin to the top element
- 向底部元素添加顶部边距或
- 为顶部元素添加底部边距