Here is the HTML and CSS I'm working with:
html {
height: 100%;
}
body {
margin: 0;
height: 100%;
padding: 20px;
}
.container {
display: flex;
}
.horizontal {
flex-direction: row;
width: 100%;
height: 100%;
}
.vertical {
flex-direction: column;
width: 100%;
height: 100%;
}
.horizontal>.container {
border-style: solid;
border-width: 0 2px 0 0;
padding: 0 5px 0 0;
margin: 0 5px 0 0;
}
.vertical>.container {
border-style: solid;
border-width: 0 0 2px 0;
padding: 0 0 5px 0;
margin: 0 0 5px 0;
}
.window {
background: green;
width: 100%;
height: 100%;
}
<div class='container horizontal'>
<div class='container vertical'>
<div class='container horizontal'>
<div class='container horizontal'>
<div class='window'>1</div>
</div>
<div class='container horizontal'>
<div class='window'>2</div>
</div>
</div>
<div class='container horizontal'>
<div class='container horizontal'>
<div class='window'>3</div>
</div>
<div class='container horizontal'>
<div class='window'>4</div>
</div>
</div>
</div>
<div class='container vertical'>
<div class='container horizontal'>
<div class='window'>5</div>
</div>
<div class='container horizontal'>
<div class='window'>6</div>
</div>
</div>
</div>
Context: This is a mock-up of a proposed design for a tiling window manager. The idea is that the line adjacent to each container represents a 'cursor' where a new window will be inserted when that container is selected and the 'create window' command is given. At any time, only the cursor for the currently selected container would be visible.
I'd like the vertical border to the right of window 2 to sit directly atop the vertical border to the left of windows 5 and 6. This should be achieved without any change to the horizontal line below windows 1 and 2 --- that is, the right edge of window 2 should line up with the right endpoint of the horizontal line below windows 1 and 2.
Here is a diagram of the desired effect:
This needs to be implemented in html and css, and should work for any structure of nested containers (with the constraint that horizontal containers may contain only multiple vertical containers or a single window, and vertical containers may contain only multiple horizontal containers or a single window).
It seems I'd be able to achieve this with negative padding (applied to the right of horizontal containers and the bottom of vertical containers), if there were such a thing. Is there a work-around?