I have encountered some errors when coding a website in CSS. I would be grateful if somebody could help me out.
What I want to do: I have 2 different divs, Main and Additional. I want for the Main div to be 60% of the total width, no matter the size of window. The second div, Additional one, should obviously have the width of the rest, it is 40% of window (again: no matter what size the window is).
What I have instead? Well, the Main div is very thin, for sure not 60% of window. I also think that the Additional div is not filling the rest of window, but filling it to some extend and then ending abruptly (?). I think (?) that for some reason when the windows of my Internet Browser is the smallest possible (mobile), then they are respectively 60% and 40%. But, for a reason that is beyond me, when the windows gets extended (for example, when I maximize in on a desktop) the divs are not “fluid” and are not changing according to the window, but staying as they were before.
So my question is: what I did wrong and how to fix that?
Source code below:
body {
background-color: #003399;
color: #FFCC00;
margin: 0;
padding: 0;
}
a:link {
color: #FFCC00;
}
a:visited {
color: #FFCC00;
}
.container {
display: table;
border-collapse: separate;
/* border-spacing: 10px */
}
.divs-equal {
display: table-cell;
}
.div-padding {
padding: 10px;
}
#main-part {
/* float: left; */
width: 60%;
border-right-style: solid;
border-right-color: #FFCC00;
border-right-width: 3px;
/* margin-right: 10px; */
height: 100%;
/* min-height: 100vh; */
}
#additional-part {
/* width: 40%; */
height: 100%;
/* min-height: 100vh; */
/* margin-left: 10px; */
}
<div class="container">
<!-- <div class="container2"> -->
<div id="main-part" class="divs-equal">
<div class="div-padding">
<h1>Main info</h1>
<p>Some text</p>
<p>Some text</p>
<p>Some text</p>
</div>
</div>
<!-- </div> -->
<!-- <div class="container3"> -->
<div id="additional-part" class="divs-equal">
<div class="div-padding">
<h1>Additional info</h1>
<p>Aaaaa</p>
<p>Aaaaa</p>
<p>Aaaaa</p>
<p>Aaaaa</p>
<p>Aaaaa</p>
<p>Aaaaa</p>
</div>
</div>
<!--</div> -->
</div>