I currently have the code in this fiddle:
HTML
<div class="stats-box">
<div class="stats-title">Stats</div>
<div class="stats-group">
<div class="stats-team red"><div class="stats-amount">367</div></div>
<div class="stats-team yellow"><div class="stats-amount">412</div></div>
</div>
</div>
SCSS No fancy SCSS, just nesting and variables, so basically ordinary CSS :-)
$red: #e74c3c;
$yellow: #f1c40f;
$white: #ecf0f1;
.stats-box {
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
font-weight: normal;
color: white;
background-color: $white;
.stats-title {
color: black;
font-weight: 700;
text-align: center;
}
.stats-group {
padding: 10px 0px;
.stats-team {
display: inline-block;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
padding: 10px;
width: 50%;
.stats-amount {
background: rgba(0,0,0,0.13);
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
padding: 7px 0px 11px 0px;
width: 100%;
height: 16px;
text-align: center;
margin: 0 auto;
}
}
}
}
.red {
color: $white;
background-color: $red;
}
.yellow {
color: $white;
background-color: $yellow;
}
I am trying to achieve making the red and yellow boxes cover exactly 50% of the screen and be positioned side by side. I want them to keep their 10px padding as well, but I am facing difficulty with this task. Whenever I set the width to above 48%, the yellow box shifts down to the next line (which might vary based on screen resolution).
The issue seems to be centered around this specific section, but I haven't been able to find a workaround yet.
.stats-team {
padding: 10px;
}
Am I missing something obvious here or am I simply asking for too much?