Match element - no content

Responsive match element with market groups.

by otinanaipali

HTML

<div class="matches">
  <div class="match live">
    <div class="details">
      <div class="teams">
        <div class="team">Λαμία</div>
        <div class="team">Αστέρας Τρίπολης Football Club</div>
      </div>
      <div class="cards">
        <div class="card">1</div>
        <div class="card">2</div>
      </div>
      <div class="scores">
        <div class="score">0</div>
        <div class="score">3</div>
      </div>
      <div class="meta">
        <div class="media">
          <div class="stream"></div>
          <div class="field"></div>
          <div class="stats"></div>
        </div>
        <div class="time">91:43 <span>+3</span></div>
      </div>
    </div>
    <div class="markets">
      <div class="marketgroup">
        <div class="title">Αποτέλεσμα ημιχρόνου</div>
        <div class="odds">
          <div class="odd">
            <div class="mark">1</div>
            <div class="value">1,80</div>
          </div>
          <div class="odd">
            <div class="mark">X</div>
            <div class="value">1,80</div>
          </div>
          <div class="odd">
            <div class="mark">2</div>
            <div class="value">1,80</div>
          </div>
        </div>
      </div>
      <div class="marketgroup">
        <!--<div class="title"></div>-->
        <div class="odds">
          <div class="odd">
            <div class="mark">O</div>
            <div class="value">1,80</div>
          </div>
          <div class="label">2,5</div>
          <div class="odd">
            <div class="mark">U</div>
            <div class="value">1,80</div>
          </div>
        </div>
      </div>
    </div>
  </div>

  <div class="match prelive">
    <div class="details">
      <div class="teams">
        <div class="team">Λαμία</div>
        <div class="team">Αστέρας Τρίπολης Football Club</div>
      </div>
      <!--<div class="cards">
        <div class="card">1</div>
        <div class="card">2</div>
      </div>
      <div...

CSS

html,
body {
  background: #202735;
  padding: 0;
  margin: 0;
  font-family: 'Open Sans', sans-serif;
  font-size: 12px;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  min-width: 1090px;
}

/* Outline containers for tracking behavior 
.match * {
  box-shadow: 0 0 1px rgba(243, 202, 62, 0.75);
}

.match.prelive * {
  box-shadow: 0 0 1px rgba(246, 0, 89, 0.75);
}
*/

.matches {
  display: flex;
  flex-direction: row;
  align-self: center;
  gap: 16px;
  margin: 80px 0;
}

.match {
  display: flex;
  flex-direction: row;
  flex: 1 1 100%;
  gap: 8px;
  padding: 8px;
  border-radius: 4px;
  min-width: 0;

  /* Allow shrinking of the match element beyond its content width
  min-width: 0;
  overflow: hidden;
  */
}

.details,
.markets {
  display: flex;
  flex-direction: row;
  align-items: center;
}

.details {
  flex: 1 1 35%;
  min-width: 240px;
}

.markets {
  flex: 1 1 65%;
  gap: 12px;

  /* Allow shrinking of markets beyond their content width
  min-width: 0;
  overflow: hidden;
  */
}

.marketgroup {
  display: flex;
  flex-direction: column;
  align-self: stretch;
  flex: 1 1 100%;

  height: 36px;

  /* Allow shrink of marketgroups
  min-width: 0;
  overflow: hidden;
  */
}

.odds {
  display: flex;
  flex-direction: row;
  flex: 1 1 100%;
  align-self: stretch;
  align-items: center;
  gap: 4px;
  min-height: 0;

  /* Allow shrink of button holder
  min-width: 0;
  overflow: hidden;
  */
}

.title {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: flex-end;
  height: 5px;
  font-size: 8px;
  font-weight: 600;
  text-transform: uppercase;
  opacity: 0.6;
  letter-spacing: 0.75px;
  line-height: 13px;
}


.odd {
  display: flex;
  flex-direction: row;
  flex: 1 1 100%;
  align-self: stretch;
  align-items: center;
  flex-wrap: wrap;
  justify-content: space-around;
  border-radius: 4px;
  padding: 0 6px;

  /* Allow shrink of each button
  min-width: 0; 
  */
}

.mark {
  padding: 1px 2px 0;
  line-height:...

JavaScript

var viewport_width = window.innerWidth;
var matchl = document.querySelector('.match.live');
var matchp = document.querySelector('.match.prelive');
var detailsl = document.querySelector('.live .details');
var detailsp = document.querySelector('.prelive .details');
var marketsl = document.querySelector('.live .markets');
var marketsp = document.querySelector('.prelive .markets');

document.getElementById('windowW').innerHTML = "Window: " + viewport_width;
document.getElementById('matchLW').innerHTML = "Live: " + matchl.offsetWidth;
document.getElementById('matchPW').innerHTML = "Prelive: " + matchp.offsetWidth;
document.getElementById('detailsLW').innerHTML = "L match: " + detailsl.offsetWidth;
document.getElementById('detailsPW').innerHTML = "P match: " + detailsp.offsetWidth;
document.getElementById('marketsLW').innerHTML = "L markets: " + marketsl.offsetWidth;
document.getElementById('marketsPW').innerHTML = "P markets: " + marketsp.offsetWidth;
document.getElementById('matchT').innerHTML = (matchl.offsetWidth) + (matchp.offsetWidth) + (16);
document.getElementById('liveT').innerHTML = (detailsl.offsetWidth) + (marketsl.offsetWidth) + (24);
document.getElementById('preT').innerHTML = (detailsp.offsetWidth) + (marketsp.offsetWidth) + (24);



window.addEventListener('resize', function(event) {
  viewport_width = window.innerWidth;
  document.getElementById('windowW').innerHTML = "Window: " + viewport_width;
  document.getElementById('matchLW').innerHTML = "Live: " + matchl.offsetWidth;
  document.getElementById('matchPW').innerHTML = "Prelive: " + matchp.offsetWidth;
  document.getElementById('detailsLW').innerHTML = "L match: " + detailsl.offsetWidth;
  document.getElementById('detailsPW').innerHTML = "P match: " + detailsp.offsetWidth;
  document.getElementById('marketsLW').innerHTML = "L markets: " + marketsl.offsetWidth;
  document.getElementById('marketsPW').innerHTML = "P markets: " + marketsp.offsetWidth;
  document.getElementById('matchT').innerHTML =...