EDIT: I'm building a simple event calendar(using HTML+CSS) and am currently working on multiple day events.
I'm a beginner to HTML&CSS and have a pretty straightforward question, but i just can't seem to find the answer: How can you make a child div overflow to the next row(of divs, etc.) if there isn't enough space on the screen(or on the row of divs) to fit the whole child div? And could you do it with only HTML&CSS(if possible) at most a bit of JavaScript? Here's what i mean should happen:
As you see, because the blue child div overflows to the second row of divs because it is to large to fit in just the first row. Currently, if my blue div is too large, it will just overflow to the side(run code below).
html, body {
left: 0;
margin: 0;
background:white;
height:100%;
}
b{
font-family:calibri;
padding-left:10px;
}
#container{
margin: 20px auto;
width:300px;
height: 150px;
border: 1px;
position:relative;
}
.colorone{
background:#FFEB3B;
width:150px;
height: 150px;
float:left;
}
.colortwo{
width:150px;
height: 150px;
background:#8BC34A;
overflow:hidden;
}
.colorthree{
left: 10px;
position: absolute;
width: 150%;
height: 20px;
background:blue;
overflow:hidden;
}
<html>
<body>
<div id="container">
<div class="colorone">
<b>4</b>
<div class="colorthree"></div>
</div>
<div class="colortwo"><b>5</b></div>
<div class="colortwo" style="float:left"><b>6</b></div>
<div class="colorone"><b>7</b></div>
</div>
</body>
</html>
I've searched and researched online & on Stack Overflow but I still can't seem to find the answer, and barely any questions on it, so any help would be greatly appreciated.
