I'm a novice and I just can't crack this one. I have three divs within a container div. They just won't line up neatly to make 100% - gaps appear between them, even though I've reset margin
and padding
to 0. As a result, the divs sometimes overflow.
I've stripped back the code to illustrate my problem simply.
body {
margin: 0;
padding: 0;
}
div {
height: 100px;
}
.outsideDiv {
width: 100%;
color: white;
background-color: black;
}
.insideDiv {
display: inline-block;
width: 33%;
}
#div1 {
background-color: red;
}
#div2 {
background-color: green;
}
#div3 {
background-color: blue;
}
<body>
<div class="outsideDiv">
<div class="insideDiv" id="div1">width = 33%</div>
<div class="insideDiv" id="div2">width = 33%</div>
<div class="insideDiv" id="div3">width = 33%</div>
</div>
</body>
I'm missing something obvious, right? Why are there thin gaps between the divs?