Is there a way to display tournament bracket using only HTML table and CSS?
Here's what I want to achieve:
Is there a way to display tournament bracket using only HTML table and CSS?
Here's what I want to achieve:
You can wrap the elements inside a position: relative;
div
element and than you can use position: absolute;
nested div
Now obviously this will be a tedious process but you can use classes to track particular points but this is the best you can achieve with pure CSS.
For the last dashed
div
you can use the following snippet to achieve that effect
.last {
border: 1px dashed #000;
border-top: 1px solid #000;
border-left: 0;
/* Top Left for positioning */
}
Last but not the least, table
won't be a good thing for this
Take a look at https://stackoverflow.com/a/262584/1592764. There's a markup for a table-based bracket along with a jsfiddle.
Here's the HTML:
<table summary="Tournament Bracket" class="bracket">
<tr>
<th>National Semi-Finals<br>Saturday November 8th</th>
<th>National Championship<br>Sunday November 9th</th>
<th>NJCAA National Champion</th>
</tr>
<tr>
<td><p>#1 Manchester CC (17-2-1)</p></td>
<td rowspan="2"><p></p></td>
<td rowspan="4"><p></p></td>
</tr>
<tr>
<td><p>#4 Triton College (13-4-0)</p></td>
</tr>
<tr>
<td><p>#2 Herkimer County CC (18-3-0)</p></td>
<td rowspan="2"><p></p></td>
</tr>
<tr>
<td><p>#3 County College of Morris (17-3-0)</p></td>
</tr>
</table>
and the CSS:
table.bracket {
border-collapse: collapse;
border: none;
}
.bracket td {
vertical-align: middle;
width: 40em;
margin: 0;
padding: 10px 0px 10px 0px;
}
.bracket td p {
border-bottom: solid 1px black;
border-top: solid 1px black;
border-right: solid 1px black;
margin: 0;
padding: 5px 5px 5px 5px;
}
.bracket th{
text-align:center;
}
EDIT: modified the CSS above to get it closer to the look you want. Here's a jsfiddle - http://jsfiddle.net/4KZ6T/236/
I see a table with 10 columns and 30 rows counting from top(Winners bracket) to bottom(Double elimination ...)
Make the table with this format, but make sure you do reset the padding and margins of the page with: * {padding: 0; margin: 0 auto;}
The next step will be to put the table in a div and ID'it #tableBody, and then start working on your table with Elem1 etc...until you reach 30 rows and 10 columns
Winner's bracket | (10 times) |
---|
(10 times) |
My version. Screenshot
https://codepen.io/grozzzny/pen/GRZNxqW
<div class="playoff-table">
<div class="playoff-table-content">
<div class="playoff-table-tour">
<div class="playoff-table-group">
<div class="playoff-table-pair playoff-table-pair-style">
<div class="playoff-table-left-player">Иванов</div>
<div class="playoff-table-right-player">Сидоров</div>
</div>
<div class="playoff-table-pair playoff-table-pair-style">
<div class="playoff-table-left-player">Иванов</div>
<div class="playoff-table-right-player">Сидоров</div>
</div>
</div>
<div class="playoff-table-group">
<div class="playoff-table-pair playoff-table-pair-style">
<div class="playoff-table-left-player">Иванов</div>
<div class="playoff-table-right-player">Сидоров</div>
</div>
<div class="playoff-table-pair playoff-table-pair-style">
<div class="playoff-table-left-player">Иванов</div>
<div class="playoff-table-right-player">Сидоров</div>
</div>
</div>
<div class="playoff-table-group">
<div class="playoff-table-pair playoff-table-pair-style">
<div class="playoff-table-left-player">Иванов</div>
<div class="playoff-table-right-player">Сидоров</div>
</div>
<div class="playoff-table-pair playoff-table-pair-style">
<div class="playoff-table-left-player">Иванов</div>
<div class="playoff-table-right-player">Сидоров</div>
</div>
</div>
<div class="playoff-table-group">
<div class="playoff-table-pair playoff-table-pair-style">
<div class="playoff-table-left-player">Иванов</div>
<div class="playoff-table-right-player">Сидоров</div>
</div>
<div class="playoff-table-pair playoff-table-pair-style">
<div class="playoff-table-left-player">Иванов</div>
<div class="playoff-table-right-player">Сидоров</div>
</div>
</div>
</div>
<div class="playoff-table-tour">
<div class="playoff-table-group">
<div class="playoff-table-pair playoff-table-pair-style">
<div class="playoff-table-left-player">Иванов</div>
<div class="playoff-table-right-player">Сидоров</div>
</div>
<div class="playoff-table-pair playoff-table-pair-style">
<div class="playoff-table-left-player">Иванов</div>
<div class="playoff-table-right-player">Сидоров</div>
</div>
</div>
<div class="playoff-table-group">
<div class="playoff-table-pair playoff-table-pair-style">
<div class="playoff-table-left-player">Иванов</div>
<div class="playoff-table-right-player">Сидоров</div>
</div>
<div class="playoff-table-pair playoff-table-pair-style">
<div class="playoff-table-left-player">Иванов</div>
<div class="playoff-table-right-player">Сидоров</div>
</div>
</div>
</div>
<div class="playoff-table-tour">
<div class="playoff-table-group">
<div class="playoff-table-pair playoff-table-pair-style">
<div class="playoff-table-left-player">Иванов</div>
<div class="playoff-table-right-player">Сидоров</div>
</div>
<div class="playoff-table-pair playoff-table-pair-style">
<div class="playoff-table-left-player">Иванов</div>
<div class="playoff-table-right-player">Сидоров</div>
</div>
</div>
</div>
<div class="playoff-table-tour">
<div class="playoff-table-group">
<div class="playoff-table-pair playoff-table-pair-style">
<div class="playoff-table-left-player">Иванов</div>
<div class="playoff-table-right-player">Сидоров</div>
</div>
<div class="playoff-table-third-place playoff-table-pair-style">
<div class="playoff-table-left-player">Иванов</div>
<div class="playoff-table-right-player">Сидоров</div>
</div>
</div>
</div>
</div>