I know it doesn't exist, but is there a pure CSS version?
Would like to set height, and make it 1px wide (with shadow, if possible).
Just cannot fathom a pure CSS way of doing this. Would need to be absolutely positioned.
As my container has two divs side by side, 60-40% split for example. Need the vertical rule between the two, but don't really want to use border-left
on div 2.
Any suggestions?
No, there is no vertical rule. It does not make logical sense to have one. HTML is parsed sequentially, meaning you lay out your HTML code from top to bottom, left to right how you want it to appear from top to bottom, left to right (generally) A vr tag does not follow that paradigm.
A vertical line can be created in HTML using transform property in <hr> tag. With the help of this property, you can rotate a horizontal line to a vertical line.
The <hr> tag in HTML is used to produce a horizontal line. However, there is no tag for creating a vertical line. The border-left CSS attribute can be used to simulate a vertical line. The border-left property of CSS is used to style the left-side border.
The HTML HR element provides semantic meaning to a page's layout. It can only be customized using CSS. But you can apply all sorts of crazy styles to a horizontal line to create very interesting layout affects.
for this you basically need to setup a place to put it and a div statement works.
<div style="width:150px;height:2px;background-color:#000000;"> </div>
this could also be referenced:
.hr {width:150px;height:2px;background-color:#000000;} // in your css file/script
<div class="hr"> </div> <!-- IN HTML -->
You can change the position and have it going up/down or left/right with css placement and z-index
.hr {width:2px;height:150px;background-color:#000000;position:absolute;top:0px;left:50px;z-index:10;} // in your css file/script
width = how wide you want it
height = how tall you want it
background-color = is the color you want it to be
position = absolute, relative, float - basically if it stays in one place or moves with page content
top = where to place in reference to top of page - could be margin-top
left = where to place in reference to left of page - could be margin-left
This post already got a awnser but I'm facing the same problem and I found something interesting:
hr, hr.vertically {
color: #b2b2b2;
background-color: #b2b2b2;
}
hr {
width: 100%;
height: 0;
}
hr.vertically {
width: 0;
height: 100%;
}
<div style="height: 400px;">
a
<hr />
<hr class="vertically" />
</div>
Hr means horizontal rule, adding a class vertically to it sounds close to a paradox, but it look's more organized to me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With