I have three divs (left, mid and right) and these divs don't have an exact height, because it depends on how many rows text are inside the div. Now I want vertical lines (which seperate the three divs) through the whole height of the users monitor, no matter how high the divs are.
How can I do this? Because , as you can see in the css-code, border-right/border-left don't work for me.
Intention HTML
<div class="content">
<div class="content_left"></div>
<div class="content_mid"></div>
<div class="content_right"></div>
</div>
CSS
.content {
line-height: 1.1;
background-color: #FFF;
color: #000;
position: absolute;
top: 36px; /* because there is a top-menu which is 36px high */
left: 70px; /* because there is a side-menu which is 70px wide */
right: 0px;
bottom: 0px;
overflow-x: hidden;
overflow-y: auto;
}
.content_left {
position: absolute;
width: 22.5%;
left: 0px;
top: 0px;
border-right: 1px solid #ccc;
padding: 10px;
overflow-x: hidden;
overflow-y:hidden;
}
.content_mid {
position: relative;
width: 50%;
top: 10px;
left: 25%;
float: left;
padding-left: 10px;
}
.content_right {
position: absolute;
width: 22.5%;
right: 0px;
top: 0px;
border-left: 1px solid #ccc;
padding: 10px;
overflow-x: hidden;
overflow-y: hidden;
}
Edit 1: I would like to have these seperate-lines 1px wide and I cannot set the height of content_left, content_mid, content_right to 100% because I have resizeable boxes in these divs.
It makes sense: both DIVs and tables can be nested, have HEIGHT and WIDTH attributes set, contain borders, etc.
There are two ways to add a horizontal line between two divs. First, put a <hr> tag between the two divs, and the second is to place any block-level element such as a div, p, etc, between the two divs and apply a bottom or top border on it. Either way, you can achieve the same task.
I think this does what you want.
JSFiddle example
The HTML structure is a bit more complicated than yours:
<div class="menu-top">Menu top</div>
<div class="wrapper">
<div class="menu-left">Menu left</div>
<div class="content">
<div class="column">
<div class="column-content">
<h1>Column 1</h1>
</div>
</div>
<div class="column">
<div class="column-content">
<h1>Column 2</h1>
</div>
</div>
<div class="column">
<div class="column-content">
<h1>Column 3</h1>
</div>
</div>
</div>
</div>
And here's the CSS:
body {
padding: 0;
margin: 0;
box-sizing: border-box;
height: 100%;
width: 100%;
}
.menu-top {
width: 100%;
height: 36px;
background-color: #3498DB;
}
.wrapper {
display: flex;
}
.menu-left {
height: calc(100vh - 36px);
width: 70px;
background-color: #59ABE3;
}
.content {
width: calc(100vw - 70px);
height: calc(100vh - 36px);
background-color: #E4F1FE;
display: flex;
}
.column {
flex: 33;
border-left: 1px solid hotpink;
}
.column:first-of-type {
border-left: none;
}
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