I am creating a vertical divider, that works fine. But the CSS is cumbersome.
The CSS is:
.headerDivider1 { border-left:1px solid #38546d;height:80px;position:absolute;right:250px;top:10px; } .headerDivider2 { border-left:1px solid #16222c;height:80px;position:absolute;right:249px;top:10px; }
The HTML is:
<div class="headerDivider1"></div><div class="headerDivider2"></div>
The result is:
How could I tidy the HTML and CSS up?
Answer: Use the CSS border Property You can use the CSS border property on a <span> element in combination with the other CSS property like display and height property to make vertical lines in HTML.
To make a vertical line, use border-left or border-right property. The height property is used to set the height of border (vertical line) element. Position property is used to set the position of vertical line. Example 1: It creates a vertical line using border-left, height and position property.
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.
.headerDivider { border-left:1px solid #38546d; border-right:1px solid #16222c; height:80px; position:absolute; right:249px; top:10px; } <div class="headerDivider"></div>
<div class="headerdivider"></div>
and
.headerdivider { border-left: 1px solid #38546d; background: #16222c; width: 1px; height: 80px; position: absolute; right: 250px; top: 10px; }
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