Here is a simple solution using pure CSS.
<div class="myDiv" id="div1"></div>
<div class="myDiv" id="div2"></div>
html, body {
margin: 0;
}
.myDiv {
border: 2px solid black;
height: 50vh;
box-sizing: border-box;
/* min-height: 200px; */
resize: vertical;
overflow: auto;
}
#div1 {
background-color: cornflowerblue;
}
#div2 {
background-color: crimson;
}
Question 1:
For the border between them to be centered, you can set the height of each to half the viewport using the vh unit. vh is a relative CSS unit defined such as 100 vh equals the browser's view port's height.
However setting height: 50vh sets the height of the div's content to 50vh instead of the entire div, therefore the height would be 50vh + padding if any + border thickness, and to avoid that use box-sizing: border-box. This makes the entire height including any padding and the border thickness 50vh.
More on box-sizing property: https://developer.mozilla.org/en-US/docs/Web/CSS/box-sizing
You can also add min-height if you want to avoid the divs being to small.
Question 2:
To add the ability for a user to resize a div add the following:
resize: vertical;
overflow: auto;
More on resize property: https://developer.mozilla.org/en-US/docs/Web/CSS/resize
I'm not sure if that's what you are looking for regarding question 2.