Copy link to clipboard
Copied
Hello
Pseudo-Tables with Definition Lists
I saw Nancy's layout in the forum a month or so back and tried this as seen in the link.
I added a div wrapper of 70%. Just an exercise to see if I could create a large amount of cells. Example about 40
Question: Why is their a gap showing?
I thought the cells would be continuous.
Another question: What is the best way to create a layout with multiple boxes/cells like a calendar or table with many cells?
David
The gap is caused by the browser default margin-top and margin-bottom on <dl> tags.
Adding the following to your css will fix that...
dl {
float:left;
margin:0;
}
Copy link to clipboard
Copied
Flexbox:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Flexbox</title>
<style>
* {
box-sizing: border-box;
}
.cells {
width: 70%;
margin: 0 auto;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
}
.cells div {
width: 11.1%;
border: 1px dotted silver;
text-align: center;
padding: 10px;
}
</style>
</head>
<body>
<div class="cells">
<div>Cell 1</div>
<div>Cell 2</div>
<div>Cell 3</div>
<div>Cell 4</div>
<div>Cell 5</div>
<div>Cell 6</div>
<div>Cell 7</div>
<div>Cell 8</div>
<div>Cell 9</div>
<div>Cell 10</div>
<div>Cell 11</div>
<div>Cell 12</div>
<div>Cell 13</div>
<div>Cell 14</div>
<div>Cell 15</div>
<div>Cell 16</div>
<div>Cell 17</div>
<div>Cell 18</div>
<div>Cell 19</div>
<div>Cell 20</div>
<div>Cell 21</div>
<div>Cell 22</div>
<div>Cell 23</div>
<div>Cell 24</div>
<div>Cell 25</div>
<div>Cell 26</div>
<div>Cell 27</div>
<div>Cell 28</div>
<div>Cell 29</div>
<div>Cell 30</div>
<div>Cell 31</div>
<div>Cell 32</div>
<div>Cell 33</div>
<div>Cell 33</div>
<div>Cell 35</div>
<div>Cell 36</div>
</div>
</body>
</html>
Copy link to clipboard
Copied
The gap is caused by the browser default margin-top and margin-bottom on <dl> tags.
Adding the following to your css will fix that...
dl {
float:left;
margin:0;
}
Copy link to clipboard
Copied
Thanks Osgood and Jon Fritz II
This fixed the issue with the margin and I learned something about Flexbox
More here: A Complete Guide to Flexbox
https://css-tricks.com/snippets/css/a-guide-to-flexbox
W3 School