Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vertical divider CSS

Tags:

html

css

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:

alt text

How could I tidy the HTML and CSS up?

like image 449
422 Avatar asked Jan 12 '11 23:01

422


People also ask

How do you make a vertical divider in CSS?

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.

How do I create a vertical separator 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.

How do I make my HR tag vertical?

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.


2 Answers

.headerDivider {      border-left:1px solid #38546d;       border-right:1px solid #16222c;       height:80px;      position:absolute;      right:249px;      top:10px;  }  <div class="headerDivider"></div> 
like image 95
amosrivera Avatar answered Sep 23 '22 01:09

amosrivera


<div class="headerdivider"></div> 

and

.headerdivider {     border-left: 1px solid #38546d;     background: #16222c;     width: 1px;     height: 80px;     position: absolute;     right: 250px;     top: 10px; } 
like image 37
orlp Avatar answered Sep 21 '22 01:09

orlp