JSFiddle - React, Tailwind, and code Playground
by Keith Jeter
HTML
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js"></script>
<div class="tournament-container">
<div class="tournament-headers">
<h3>Round of 16</h3>
<h3>Quarter-Finals</h3>
<h3>Semi-Finals</h3>
<h3>Final</h3>
<h3>Winner</h3>
</div>
<div class="tournament-brackets">
<ul class="bracket bracket-1">
<li class="team-item">Grandle <time>vs</time> Robe Knight</li>
<li class="team-item">D1 <time>vs</time> 3BEF</li>
<li class="team-item">B1 <time>vs</time> 3ACD</li>
<li class="team-item">F1 <time>vs</time> E2</li>
<li class="team-item">C1 <time>vs</time> 3ABF</li>
<li class="team-item">E1 <time>vs</time> D2</li>
<li class="team-item">A1 <time>vs</time> 3CDE</li>
<li class="team-item">B2 <time>vs</time> F2</li>
</ul>
<ul class="bracket bracket-2">
<li class="team-item">QF1 <time>vs</time> QF2</li>
<li class="team-item">QF3 <time>vs</time> QF4</li>
<li class="team-item">QF5 <time>vs</time> QF6</li>
<li class="team-item">QF7 <time>vs</time> QF8</li>
</ul>
<ul class="bracket bracket-3">
<li class="team-item">SF1 <time>vs</time> SF2</li>
<li class="team-item">SF3 <time>vs</time> SF4</li>
</ul>
<ul class="bracket bracket-4">
<li class="team-item">F1 <time>vs</time> F2</li>
</ul>
<ul class="bracket bracket-5">
<li class="team-item">European Champions</li>
</ul>
</div>
</div>
CSS
html {
height: 100%;
width: 100%;
}
body {
font-family: sans-serif;
margin: 0;
height: 100%;
}
.tournament-container {}
.tournament-headers {
flex-grow: 1;
display: flex;
flex-direction: row;
justify-content: space-around;
border-bottom: 1px solid #ccc;
h3 {
width: 25%;
text-align:center;
font-weight: 400;
border-right: 1px dashed #ccc;
margin: 0;
padding:1rem;
}
}
.tournament-brackets {
display: flex;
flex-direction: row;
list-style-type: none;
background: #fdfdfd;
margin-bottom: 50px;
}
.bracket {
padding-left: 0;
display: flex;
margin: 0;
padding: 30px 0;
flex-grow: 1;
flex-direction: column;
justify-content: space-around;
list-style-type: none;
border-right: 1px dashed #ccc;
flex: 1;
}
.team-item {
background-color: #f4f4f4;
padding: .5rem;
display: block;
margin: .5rem 10px;
position: relative;
vertical-align: middle;
line-height: 2;
text-align: center;
}
.team-item:after {
content:'';
border-color: #4f7a38;
border-width: 2px;
position: absolute;
display: block;
width: 10px;
right: -11px;
}
.team-item:nth-of-type(odd):after {
border-right-style: solid;
border-top-style: solid;
height: 100%;
top: 50%;
}
.team-item:nth-of-type(even):after {
border-right-style: solid;
border-bottom-style: solid;
height: 100%;
top: -50%;
}
.team-item:before {
content:'';
border-top: 2px solid #4f7a38;
position: absolute;
height: 2px;
width: 10px;
left: -10px;
top: 50%;
}
.bracket-2 {
.team-item:nth-of-type(odd):after {
height: 200%;
top: 50%;
}
.team-item:nth-of-type(even):after {
height: 200%;
top: -150%;
}
}
.bracket-3 {
.team-item:nth-of-type(odd):after {
height: 350%;
top: 50%;
}
.team-item:nth-of-type(even):after {
height: 350%;
top: -300%;
}
}
.bracket-4 {
.team-item:nth-of-type(odd):after {
height: 700%;
top: 50%;
}
.team-item:nth-of-type(even):after {
...