There are multiple answers across Stack Overflow to do this. I couldn't find one that has three common in one answer (please mark the question as duplicate if there is).
First method: Flexbox
For this method, we can wrap your two elements in a parent container (flex-container) which makes the children flex items. This is similar to float elements, but keeps elements a little more predictable.
Each of the children - chart and form, have flex properties set: shrink, grow and basis. Grow is the ratio that it the element will grow in relation to other elements and it's parent.
Shrink is the opposite - the rate at which the element will shrink comparatively to other elements/parent.
Basis is the minimum width the element starts at. Think of it as the width property.
More reading on flex: https://css-tricks.com/snippets/css/a-guide-to-flexbox/
.flex-container {
display: flex;
flex-flow: row nowrap;
}
#chart_container {
background: red;
flex-grow: 1;
flex-shrink: 1;
flex-basis: 66.666%;
}
.form-popup {
background: blue;
flex-grow: 1;
flex-shrink: 1;
flex-basis: 33.333%;
}
<div class="flex-container">
<div id="chart_container" #chart_container>
<!-- <pan-zoom [config]="panzoomConfig"> -->
<div class="flowchart-example-container" id="exampleDiv" #exampleDiv>
Chart chart chart chart
</div>
<!-- </pan-zoom> -->
</div>
<div class="form-popup" id="myForm">
<form action="/action_page.php" class="form-container">
<h1>Login</h1>
<label for="email"><b>Email</b></label>
<input type="text" placeholder="Enter Email" name="email" required>
<label for="psw"><b>Password</b></label>
<input type="password" placeholder="Enter Password" name="psw" required>
<button type="submit" class="btn">Login</button>
<button type="button" class="btn cancel" onclick="closeForm()">Close</button>
</form>
</div>
</div>
Second method: Float
Using float, we can position elements next to each other. So we set float: left on each div. No need for a parent container. The thing to remember is the width's of the elements need to equal 100%. So, in this example, I use calc( 66.666% - 10px ) to account for the 10px margin on the chart. Luckily CSS does calculations for us.
#chart_container {
float: left;
width: calc( 66.666% - 10px);
background: red;
}
.form-popup {
float: left;
width: 33.333%;
background: blue;
}
<div id="chart_container" #chart_container style="margin-right: 10px;">
<!-- <pan-zoom [config]="panzoomConfig"> -->
<div class="flowchart-example-container" id="exampleDiv" #exampleDiv>
Chart chart chart chart
</div>
<!-- </pan-zoom> -->
</div>
<div class="form-popup" id="myForm">
<form action="/action_page.php" class="form-container">
<h1>Login</h1>
<label for="email"><b>Email</b></label>
<input type="text" placeholder="Enter Email" name="email" required>
<label for="psw"><b>Password</b></label>
<input type="password" placeholder="Enter Password" name="psw" required>
<button type="submit" class="btn">Login</button>
<button type="button" class="btn cancel" onclick="closeForm()">Close</button>
</form>
</div>
Third Method: Grid
This one is a bit more complex, but it's similar to flex, where you assign elements to a grid system.
I kept this very simple for your use, but overall, you have a parent element with display: grid and other properties that define the grid.
Here is some good reading: https://css-tricks.com/snippets/css/complete-guide-grid/
.grid-container {
display: grid;
grid-template-areas: "chart form";
grid-template-columns: 66.666% 33.333%;
grid-template-rows: 1fr;
}
#chart_container {
background: red;
grid-area: chart;
}
.form-popup {
background: blue;
grid-area: form;
}
<div class="grid-container">
<div id="chart_container" #chart_container>
<!-- <pan-zoom [config]="panzoomConfig"> -->
<div class="flowchart-example-container" id="exampleDiv" #exampleDiv>
Chart chart chart chart
</div>
<!-- </pan-zoom> -->
</div>
<div class="form-popup" id="myForm">
<form action="/action_page.php" class="form-container">
<h1>Login</h1>
<label for="email"><b>Email</b></label>
<input type="text" placeholder="Enter Email" name="email" required>
<label for="psw"><b>Password</b></label>
<input type="password" placeholder="Enter Password" name="psw" required>
<button type="submit" class="btn">Login</button>
<button type="button" class="btn cancel" onclick="closeForm()">Close</button>
</form>
</div>
</div>
That's a bunch to take in, but those are three methods you can use.