You may be facing an issue where your 1px borders are creating a 2px border space due to their alignment. An effective solution is to eliminate the outline
, introduce a 1px gap
on #calendars-container
, and utilize box-shadow
to simulate the borders. Since box-shadow is drawn inside the element, it allows for overlapping:
#calendars-container
{
text-align: center;
font-family: Roboto;
font-size: 9pt;
display: flex;
flex-wrap: wrap;
justify-content: center;
align-items: stretch;
gap: 1px;
}
table.calendar
{
border-collapse: collapse;
margin: 0;
box-shadow: 0 0 0 1px #000;
}
https://jsfiddle.net/e6y9nkd8/
#calendars-container
{
text-align: center;
font-family: Roboto;
font-size: 9pt;
display: flex;
flex-wrap: wrap;
justify-content: center;
align-items: stretch;
gap: 1px;
}
table.calendar
{
border-collapse: collapse;
margin: 0;
box-shadow: 0 0 0 1px #000;
}
table.calendar thead {
background-color: #e6eaef;
}
table.calendar th {
font-weight: normal;
line-height: 1.5;
}
table.calendar th.month {
background-color: #d9d9d9;
line-height: 1.75;
}
table.calendar td {
padding: 2px 4px;
}
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Roboto&display=swap" rel="stylesheet">
</head>
<html>
<body>
<div id="calendars-container">
<table class="calendar">
<thead>
<tr>
<th class="month" colspan="7">June 2023</th>
</tr>
<tr>
<th abbr="S">S</th>
<th abbr="M">M</th>
<th abbr="T">T</th>
<th abbr="W">W</th>
<th abbr="T">T</th>
<th abbr="F">F</th>
<th abbr="S">S</th>
</tr>
</thead>
<tbody>
<tr>
<td colspan="4"> </td>
<td>1</td>
<td>2</td>
<td>3</td>
</tr>
<tr>
<td>4</td>
<td>5</td>
<td>6</td>
<td>7</td>
<td>8</td>
<td>9</td>
<td>10</td>
</tr>
<tr>
<td>11</td>
<td>12</td>
<td>13</td>
<td>14</td>
<td>15</td>
<td>16</td>
<td>17</td>
</tr>
<tr>
<td>18</td>
<td>19</td>
<td>20</td>
<td>21</td>
<td>22</td>
<td>23</td>
<td>24</td>
</tr>
<tr>
<td>25</td>
<td>26</td>
<td>27</td>
<td>28</td>
<td>29</td>
<td>30</td>
<td colspan="1"> </td>
</tr>
</tbody>
</table>
...
<!-- Repeat similar table structures for different months -->
</div>
</body>
</html>