I am currently attempting to create a square consisting of 4 smaller squares inside, but I have been facing challenges with the method I was using. Here is the code snippet:
#grandbox {
position: absolute;
width: 204px;
height: 204px;
border: solid thin black;
left: 40%;
top: 8%;
}
div.smallbox {
border: solid thin black;
text-align: center;
width: 100px;
height: 100px;
float: left;
line-height: 100px;
}
<div id="grandbox">
<div class="smallbox"></div>
<div class="smallbox"></div>
<div class="smallbox"></div>
<div class="smallbox"></div>
</div>
My intention was to style the borders in CSS as follows:
border: 2px solid black
However, when I applied this, the boxes broke out of the larger box and were displayed vertically.
I'm relatively new to this field, having recently embarked on my career, so I am struggling to understand why it's not working.
PS: Apologies for any errors in English, as it is not my native language.