CSS中的垂直规则(相对于)

前端之家收集整理的这篇文章主要介绍了CSS中的垂直规则(相对于)前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
我知道它不存在,但是是否有一个纯CSS版本?

想设置高度,并使其为1px宽(如果可能,使用阴影)。

只是不能理解这样做的纯CSS方式。需要绝对定位。

由于我的容器并排有两个div,例如60-40%的分割。需要两者之间的垂直规则,但不要在div 2上使用border-left。

有什么建议么?

解决方法

为此,您基本上需要设置一个放置它并且一个div语句工作的地方。
  1. <div style="width:150px;height:2px;background-color:#000000;">&nbsp;</div>

这也可以参考:

  1. .hr {width:150px;height:2px;background-color:#000000;} // in your css file/script
  2.  
  3. <div class="hr">&nbsp;</div> <!-- IN HTML -->

您可以通过css放置和z-index更改位置并使其上/下或左/右

  1. .hr {width:2px;height:150px;background-color:#000000;position:absolute;top:0px;left:50px;z-index:10;} // in your css file/script

基本上

  1. width = how wide you want it
  2. height = how tall you want it
  3. background-color = is the color you want it to be
  4. position = absolute,relative,float - basically if it stays in one place or moves with page content
  5. top = where to place in reference to top of page - could be margin-top
  6. left = where to place in reference to left of page - could be margin-left

猜你在找的CSS相关文章