here is the violin
I want the two divs side by side to occupy the entire width of the window. I use display:inline-blockfor them to behave horizontally.
<div id="left" class="horizontal">hello</div>
<div id="right" class="horizontal">world</div>
The problem is that when I set their width to 100% (20% on the left and 80% on the right), they occupy a larger screen and the div on the right falls under another.
I will get around this by setting the width to less than 100% (19% and 79%), but later this has some minor issues, sometimes putting unnecessary spaces where I don't want to.
What am I missing so that my divs go horizontally using 100% of the screen?
I have seen the tricks listed here as well as this question ... and most of them are so ugly, I still prefer to use a width of less than 100%.
* {
padding:0;
margin:0;
border:0;
border-spacing:0;
box-sizing: border-box;
-moz-box-sizing: border-box;
}
html {
height:100%;
}
body {
height:100%;
}
#left {
background-color: red;
width:20%;
height:100%;
}
#right {
background-color: green;
width:80%;
height:100%;
}
.horizontal {
display: inline-block;
}
source
share