任何方式来限制边界长度? [英] Any way to limit border length?

查看:113
本文介绍了任何方式来限制边界长度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有任何方法来限制边框的长度。我有一个< div> 有一个底部边框,但我想添加一个边框的< div> code>只伸展一半的路。

Is there any way to limit the length of a border. I have a <div> that has a bottom border, but I want to add a border on the left of the <div> that only stretches half of the way up.

有没有办法做到这一点,而不在页面上添加额外的元素?

Is there any way to do so without adding extra elements on the page?

推荐答案

希望这有助于:

#mainDiv {
  height: 100px;
  width: 80px;
  position: relative;
  border-bottom: 2px solid #f51c40;
  background: #3beadc;
}

#borderLeft {
  border-left: 2px solid #f51c40;
  position: absolute;
  top: 50%;
  bottom: 0;
}

<div id="mainDiv">
  <div id="borderLeft"></div>
</div>

这篇关于任何方式来限制边界长度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆