0
Hello
I’m trying to get s div’s to automatically fit together next to each other and if there’s no space on the side go and automatically fit from left to right, but it’s not working.
NOTE: What determines the format of the DIV is the image that goes inside it.
Follow my code and the image of how I want to do.
HTML code
<html>
<head>
<title></title>
<style>
article .tile {
display: block;
float: left;
box-sizing: border-box;
width: 100px;
height: 100px;
font-size: 3em;
font-weight: 700;
padding: 0 6px;
color: #fff;
text-shadow: -1px 0 black, 0 1px black, 1px 0 black, 0 -1px black;
border:1px dotted black;
}
article .tile.wide {
width: 200px;
}
article .tile.tall {
height: 200px;
}
.tile.yellow { background: yellow; }
.tile.red { background: red; }
.tile.blue { background: blue; }
.tile.black { background: black; }
.tile.grey { background: grey; }
.tile.green { background: green; }
</style>
</head>
<body>
<article>
<div class="tile blue"><p>1</p></div>
<div class="tile black"><p>2</p></div>
<div class="tile yellow"><p>3</p></div>
<div class="tile grey"><p>4</p></div>
<div class="tile red"><p>5</p></div>
</article>
</body>
</html>
Thank you
I thought the questioning was simple, but I may have misunderstood. In this case an example would be a div.container with width: 600px; Height: Auto; padding: 10px(if necessary) - And div’s. box with float: left; width: auto; height: auto; padding: 2px; margin: 5px; if you exceed the container space jumps down and increases the container height.
– Cleverson