I want to have a responsive 9x9 div grid with no scrollbar. The div grid should resize according to the visible browser window. I've combined "How to maintain the aspect ratio of a div using only CSS" with "Grid of responsive squares":
html
<div class="stretchy-wrapper">
<div class="inner">
<div class="square">
<div class="content">
<div class="table">
<div class="table-cell numbers">
98%
</div>
</div>
</div>
</div>
<div class="square">
<div class="content">
<div class="table">
<div class="table-cell numbers">
3.9/5
</div>
</div>
</div>
</div>
<div class="square">
<div class="content">
<div class="table">
<div class="table-cell numbers">
3.9/5
</div>
</div>
</div>
</div>
<div class="square">
<div class="content">
<div class="table">
<div class="table-cell numbers">
3.9/5
</div>
</div>
</div>
</div>
<div class="square">
<div class="content">
<div class="table">
<div class="table-cell numbers">
3.9/5
</div>
</div>
</div>
</div>
<div class="square">
<div class="content">
<div class="table">
<div class="table-cell numbers">
3.9/5
</div>
</div>
</div>
</div>
<div class="square">
<div class="content">
<div class="table">
<div class="table-cell numbers">
3.9/5
</div>
</div>
</div>
</div>
<div class="square">
<div class="content">
<div class="table">
<div class="table-cell numbers">
3.9/5
</div>
</div>
</div>
</div>
<div class="square">
<div class="content">
<div class="table">
<div class="table-cell numbers">
3.9/5
</div>
</div>
</div>
</div>
</div>
</div>
css
#import url(http://fonts.googleapis.com/css?family=Lato:400,900); /* <-- Just for the demo, Yes I like pretty fonts... */
.square {
float:left;
position: relative;
width: 30%;
padding-bottom : 30%; /* = width for a 1:1 aspect ratio */
margin:1.66%;
background-color:#1E1E1E;
overflow:hidden;
}
.content {
position:absolute;
height:90%; /* = 100% - 2*5% padding */
width:90%; /* = 100% - 2*5% padding */
padding: 5%;
}
.table{
display:table;
width:100%;
height:100%;
}
body {
font-size:20px;
font-family: 'Lato',verdana, sans-serif;
color: #fff;
text-align:center;
background:#ECECEC;
}
.numbers{
font-weight:900;
font-size:100px;
}
div.stretchy-wrapper {
width: 100%;
padding-bottom: 56.25%; /* 16:9 */
position: relative;
background: lightgrey;
}
div.stretchy-wrapper > .inner {
position: absolute;
top: 0; bottom: 0; left: 0; right: 0;
color: white;
font-size: 24px;
text-align: center;
}
However the divs still get expanded to maximum width which causes scroll bars: Fiddle.
What is the css trick that the divs are only expanded to the maximum visible width or height? So I don't get scroll bars?
Solved it with Flexbox and vmin
css
.container {
margin: 0 auto;
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: space-around;
align-items: center;
align-content: space-around;
height: 93vmin;
width: 93vmin;
background: lightgrey;
}
.cell {
height: 30vmin;
width: 30vmin;
background-color:#1E1E1E;
}
html
<div class="container">
<div class="cell"></div>
<div class="cell"></div>
<div class="cell"></div>
<div class="cell"></div>
<div class="cell"></div>
<div class="cell"></div>
<div class="cell"></div>
<div class="cell"></div>
<div class="cell"></div>
</div>
Full Screen Fiddle
Fiddle
Recommended read about flexbox
Related
I am trying to lay down all these square divs horizontally but when I set display:inline-block on the parent div, everything shrinks down and collapses into a pellet. If I use flex, I feel like I need to tweak flex property to my need. Is there a simple way to fix it?(I want them to always occupy two lines evenly with the gap in between in response to the changing viewport width)
.square {
position: relative;
margin: 0;
max-width: 60px;
border: 1px dotted black;
border-radius: 4px;
}
.square:after {
content: "";
display: block;
padding-bottom: 100%;
}
.square .content {
position: absolute;
width: 100%;
height: 100%;
}
<div class="number-of-round">
<div class="square">
<div class="content flex flex-center">1</div>
</div>
<div class="square">
<div class="content flex flex-center">2</div>
</div>
<div class="square">
<div class="content flex flex-center">3</div>
</div>
<div class="square">
<div class="content flex flex-center">4</div>
</div>
<div class="square">
<div class="content flex flex-center">5</div>
</div>
<div class="square">
<div class="content flex flex-center">6</div>
</div>
<div class="square">
<div class="content flex flex-center">7</div>
</div>
<div class="square">
<div class="content flex flex-center">8</div>
</div>
<div class="square">
<div class="content flex flex-center">9</div>
</div>
<div class="square">
<div class="content flex flex-center">10</div>
</div>
<div class="square">
<div class="content flex flex-center">11</div>
</div>
<div class="square">
<div class="content flex flex-center">12</div>
</div>
</div>
You need to set a width not max-width when using inline-block. Unlike block elements, inline-block doesn't take the full parent width so max-width will have no effect
.square {
display: inline-block;
position: relative;
margin: 0;
width: 60px;
border: 1px dotted black;
border-radius: 4px;
}
.square:after {
content: "";
display: block;
padding-bottom: 100%;
}
.square .content {
position: absolute;
width: 100%;
height: 100%;
}
<div class="number-of-round">
<div class="square">
<div class="content flex flex-center">1</div>
</div>
<div class="square">
<div class="content flex flex-center">2</div>
</div>
<div class="square">
<div class="content flex flex-center">3</div>
</div>
<div class="square">
<div class="content flex flex-center">4</div>
</div>
<div class="square">
<div class="content flex flex-center">5</div>
</div>
<div class="square">
<div class="content flex flex-center">6</div>
</div>
<div class="square">
<div class="content flex flex-center">7</div>
</div>
<div class="square">
<div class="content flex flex-center">8</div>
</div>
<div class="square">
<div class="content flex flex-center">9</div>
</div>
<div class="square">
<div class="content flex flex-center">10</div>
</div>
<div class="square">
<div class="content flex flex-center">11</div>
</div>
<div class="square">
<div class="content flex flex-center">12</div>
</div>
</div>
.square {
width:10vw;
max-width:60px;aspect-ratio:1;
margin-bottom:3vw;
border: 1px dotted black;
border-radius: 4px;
}
.number-of-round{
display:flex;
justify-content: space-between;}
<div class="number-of-round">
<div class="square">
<div class="content flex flex-center">1</div>
</div>
<div class="square">
<div class="content flex flex-center">2</div>
</div>
<div class="square">
<div class="content flex flex-center">3</div>
</div>
<div class="square">
<div class="content flex flex-center">4</div>
</div>
<div class="square">
<div class="content flex flex-center">5</div>
</div>
<div class="square">
<div class="content flex flex-center">6</div>
</div>
</div>
<div class="number-of-round">
<div class="square">
<div class="content flex flex-center">7</div>
</div>
<div class="square">
<div class="content flex flex-center">8</div>
</div>
<div class="square">
<div class="content flex flex-center">9</div>
</div>
<div class="square">
<div class="content flex flex-center">10</div>
</div>
<div class="square">
<div class="content flex flex-center">11</div>
</div>
<div class="square">
<div class="content flex flex-center">12</div>
</div>
</div>
I'm trying to make it such that I have two half-width wrappers side by side. Currently the wrappers do take half the space but don't appear side to side. The display:flex seems to be taking the whole width and leaving the unused space on the side as margin.
.wrapper {
display: flex;
flex-direction: column;
width: 40%;
border: 1px solid black;
}
<div class="wrapper">
<div class="title">Test Title</div>
<div class="info">
<div class="column">
<b>1</b>
<span>One</span>
</div>
<div class="column">
<b>2</b>
<span>Two</span>
</div>
</div>
</div>
<div class="wrapper">
<div class="title">Test Title</div>
<div class="info">
<div class="column">
<b>1</b>
<span>One</span>
</div>
<div class="column">
<b>2</b>
<span>Two</span>
</div>
</div>
</div>
I also tried adding another div outside wrapper with width 50% but it didn't help. Any ideas?
Instead of display: flex, use display: inline-flex.
The first is a block-level element which, by default, takes the full width of the parent.
The second is an inline-level element, which can co-exist with other elements on the same line.
.wrapper {
display: inline-flex;
flex-direction: column;
width: 40%;
border: 1px solid black;
}
<div class="wrapper">
<div class="title">Test Title</div>
<div class="info">
<div class="column">
<b>1</b>
<span>One</span>
</div>
<div class="column">
<b>2</b>
<span>Two</span>
</div>
</div>
</div>
<div class="wrapper">
<div class="title">Test Title</div>
<div class="info">
<div class="column">
<b>1</b>
<span>One</span>
</div>
<div class="column">
<b>2</b>
<span>Two</span>
</div>
</div>
</div>
Alternatively, set the parent element to display: flex which, by default, forces the children to exist in the same row.
Add this to your code: body { display: flex }.
.wrapper {
display: flex;
flex-direction: column;
width: 40%;
border: 1px solid black;
}
body {
display: flex;
}
<div class="wrapper">
<div class="title">Test Title</div>
<div class="info">
<div class="column">
<b>1</b>
<span>One</span>
</div>
<div class="column">
<b>2</b>
<span>Two</span>
</div>
</div>
</div>
<div class="wrapper">
<div class="title">Test Title</div>
<div class="info">
<div class="column">
<b>1</b>
<span>One</span>
</div>
<div class="column">
<b>2</b>
<span>Two</span>
</div>
</div>
</div>
I believe display: flex is similar to display: block if it's a top level element. The difference being; the children of the flex container will be able to utilize the flex behavior. What you need to do is something like this:
body {
margin: 0;
}
.parent {
display: flex;
height: 100vh;
background: #eee;
}
.child {
display: flex;
flex-direction: column;
flex: 1;
border: 1px dashed #ccc;
}
<div class='parent'>
<div class='child column'>child 1</div>
<div class='child column'>child 2</div>
</div>
Wrap the wrappers with div and then display: flex.
.main-wrapper {
display: flex;
}
.wrapper {
display: flex;
flex-direction: column;
width: 50%;
border: 1px solid black;
}
<div class="main-wrapper">
<div class="wrapper">
<div class="title">Test Title</div>
<div class="info">
<div class="column">
<b>1</b>
<span>One</span>
</div>
<div class="column">
<b>2</b>
<span>Two</span>
</div>
</div>
</div>
<div class="wrapper">
<div class="title">Test Title</div>
<div class="info">
<div class="column">
<b>1</b>
<span>One</span>
</div>
<div class="column">
<b>2</b>
<span>Two</span>
</div>
</div>
</div>
</div>
HTML
<div class="container">
<div class="row">
<div class="col-md-4">
<div class="content">1x1</div>
</div>
<div class="col-md-4">
<div class="content">1x2</div>
</div>
<div class="col-md-4">
<div class="content">1x3</div>
</div>
</div>
<div class="row">
<div class="col-md-4">
<div class="content">2x1</div>
</div>
<div class="col-md-4">
<div class="content">2x2</div>
</div>
<div class="col-md-4">
<div class="content">2x3</div>
</div>
</div>
<div class="row">
<div class="col-md-4">
<div class="content">3x1</div>
</div>
<div class="col-md-4">
<div class="content">3x2</div>
</div>
<div class="col-md-4">
<div class="content">3x3</div>
</div>
</div>
</div>
CSS
.container {
text-align: center;
display: flex;
flex-direction: column;
}
.content {
background-color: #1A1919;
color: white;
height: 400px;
width: 300px;
}
.row{
padding: 5px;
}
I have managed to make vertical spaces between the columns by adding padding to the rows. But now the horizontal spaces between the contents are ways too much. How can I configure the spacing between them?
That large horizontal space is because of the fixed width of the content class if you remove that, you'll see it grow.
You can set the width of the content in % or add a margin to the content class.
.container {
text-align: center;
}
.content {
background-color: #1A1919;
color: white;
height: 400px;
}
.row{
padding:15px;
}
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css">
<!-- jQuery library -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<!-- Latest compiled JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<div class="container">
<div class="row">
<div class="col-md-4 col4">
<div class="content">1x1</div>
</div>
<div class="col-md-4 col4">
<div class="content">1x2</div>
</div>
<div class="col-md-4 col4">
<div class="content">1x3</div>
</div>
</div>
<div class="row ">
<div class="col-md-4 col4">
<div class="content">2x1</div>
</div>
<div class="col-md-4 col4">
<div class="content">2x2</div>
</div>
<div class="col-md-4 col4">
<div class="content">2x3</div>
</div>
</div>
<div class="row col4 col4">
<div class="col-md-4 col4">
<div class="content">3x1</div>
</div>
<div class="col-md-4 col4">
<div class="content">3x2</div>
</div>
<div class="col-md-4">
<div class="content">3x3</div>
</div>
</div>
</div>
CSS Grid to achieve that layout you desire:
.grid-container {
display: grid;
grid-template-columns: auto auto auto;
grid-gap: 5px;
position:absolute;
left:50%;
transform:translateX(-50%);
width:80%;
}
.item {
background-color: gray;
text-align: center;
font-size: 30px;
min-height:100px;
max-width: 350px;
}
<div class="grid-container">
<div class="item">1x1</div>
<div class="item">1x2</div>
<div class="item">1x3</div>
<div class="item">2x1</div>
<div class="item">2x2</div>
<div class="item">2x3</div>
<div class="item">3x1</div>
<div class="item">3x2</div>
<div class="item">3x3</div>
</div>
Using flexbox:
.flex-container {
display: flex;
/*Generates a flexbox layout with default flex direction as row */
width: 100%;
/* Not really required */
align-items: center;
/*Aligns contents vertically */
justify-content: center;
/*Aligns contents horizontally */
text-align: center;
/*Aligns further text in the center */
}
.item {
background-color: gray;
text-align: center;
font-size: 30px;
min-height: 400px;
width: 300px;
margin: 5px;
}
<div class="flex-container">
<div class="item">1</div>
<div class="item">2</div>
<div class="item">3</div>
</div>
<div class="flex-container">
<div class="item">4</div>
<div class="item">5</div>
<div class="item">6</div>
</div>
<div class="flex-container">
<div class="item">7</div>
<div class="item">8</div>
<div class="item">9</div>
</div>
Use float:left; with class content as below:
.container {
text-align: center;
display: flex;
flex-direction: column;
}
.content {
float: left;
background-color: #1A1919;
color: white;
height: 400px;
width: 300px;
}
.row{
padding: 5px;
}
<div class="container">
<div class="row">
<div class="col-md-4">
<div class="content">1x1</div>
</div>
<div class="col-md-4">
<div class="content">1x2</div>
</div>
<div class="col-md-4">
<div class="content">1x3</div>
</div>
</div>
<div class="row">
<div class="col-md-4">
<div class="content">2x1</div>
</div>
<div class="col-md-4">
<div class="content">2x2</div>
</div>
<div class="col-md-4">
<div class="content">2x3</div>
</div>
</div>
<div class="row">
<div class="col-md-4">
<div class="content">3x1</div>
</div>
<div class="col-md-4">
<div class="content">3x2</div>
</div>
<div class="col-md-4">
<div class="content">3x3</div>
</div>
</div>
</div>
If I'm reading your request correctly, you are just asking how to make it look like the boxes are in the center of the page, and they are evenly spaced. see if this is what you're looking for:
.container {
text-align: center;
display: flex;
flex-direction: column;
}
.content {
background-color: #1A1919;
color: white;
height: 400px;
width: 300px;
}
.col-md-4 {
margin: 5px -10px 0px -4px;;
}
play with the numbers until you get the desired location.
Though I would strongly suggest that you add your own class in addition to col-md-4 to the boxes, which will prevent this new setting to col-md-4 from affecting any future use of this bootstrap class.
in other words . . .
CSS:
.container {
text-align: center;
display: flex;
flex-direction: column;
}
.content {
background-color: #1A1919;
color: white;
height: 400px;
width: 300px;
}
.box-move {
margin: 5px -10px 0px -4px;;
}
and HTML:
<div class="container">
<div class="row">
<div class="col-md-4 box-move">
<div class="content">1x1</div>
</div>
<div class="col-md-4 box-move">
<div class="content">1x2</div>
</div>
<div class="col-md-4 box-move">
<div class="content">1x3</div>
</div>
</div>
<div class="row">
<div class="col-md-4 box-move">
<div class="content">2x1</div>
</div>
<div class="col-md-4 box-move">
<div class="content">2x2</div>
</div>
<div class="col-md-4 box-move">
<div class="content">2x3</div>
</div>
</div>
<div class="row">
<div class="col-md-4 box-move">
<div class="content">3x1</div>
</div>
<div class="col-md-4 box-move">
<div class="content">3x2</div>
</div>
<div class="col-md-4 box-move">
<div class="content">3x3</div>
</div>
</div>
</div>
You can remove a lot of the stuff there and simplify it to make it responsive width a set margin:
.contents {
background-color: black;
color: white;
height: 500px;
margin: 20px 0px;
}
<div class="container-fluid text-center">
<div class="row">
<div class="col-md-4">
<div class="contents">1x1</div>
</div>
<div class="col-md-4">
<div class="contents">1x2</div>
</div>
<div class="col-md-4">
<div class="contents">1x3</div>
</div>
</div>
<div class="row">
<div class="col-md-4">
<div class="contents">2x1</div>
</div>
<div class="col-md-4">
<div class="contents">2x2</div>
</div>
<div class="col-md-4">
<div class="contents">2x3</div>
</div>
</div>
<div class="row">
<div class="col-md-4">
<div class="contents">3x1</div>
</div>
<div class="col-md-4">
<div class="contents">3x2</div>
</div>
<div class="col-md-4">
<div class="contents">3x3</div>
</div>
</div>
</div>
</div>
I am looking for ways to add in a 3x3 grid of circle icons to my website. Each icon needs to contain a caption text (including sub-caption text) and be spaced evenly apart. The center icons need to be in the center of the webpage.
I unfortunately have been stuck for the last couple of hours, and I have no idea on how to achieve this. I would appreciate any help.
Here is a mostly flexbox grid with square cells and centered content that will evenly space the circle/text.
* {
box-sizing: border-box; margin: 0; padding: 0;
}
.grid {
display: flex;
flex-wrap: wrap;
max-width: 960px;
width: 90%;
margin: auto;
background: #eee;
}
.cell {
flex-basis: 33.3%;
display: flex;
justify-content: center;
align-items: center;
border: 1px solid #fff;
}
.cell:before {
padding-bottom: 100%;
display: block;
content: '';
}
.circle {
background: #ccc;
border-radius: 50%;
width: 100px;
height: 100px;
margin: 0 auto 1em;
}
.inner {
text-align: center;
}
<div class="grid">
<div class="cell">
<div class="inner">
<div class="circle"></div>
<div class="caption">
<h2>text</h2>
<h3>sub</h3>
</div>
</div>
</div>
<div class="cell">
<div class="inner">
<div class="circle"></div>
<div class="caption">
<h2>text</h2>
<h3>sub</h3>
</div>
</div>
</div>
<div class="cell">
<div class="inner">
<div class="circle"></div>
<div class="caption">
<h2>text</h2>
<h3>sub</h3>
</div>
</div>
</div>
<div class="cell">
<div class="inner">
<div class="circle"></div>
<div class="caption">
<h2>text</h2>
<h3>sub</h3>
</div>
</div>
</div>
<div class="cell">
<div class="inner">
<div class="circle"></div>
<div class="caption">
<h2>text</h2>
<h3>sub</h3>
</div>
</div>
</div>
<div class="cell">
<div class="inner">
<div class="circle"></div>
<div class="caption">
<h2>text</h2>
<h3>sub</h3>
</div>
</div>
</div>
<div class="cell">
<div class="inner">
<div class="circle"></div>
<div class="caption">
<h2>text</h2>
<h3>sub</h3>
</div>
</div>
</div>
<div class="cell">
<div class="inner">
<div class="circle"></div>
<div class="caption">
<h2>text</h2>
<h3>sub</h3>
</div>
</div>
</div>
<div class="cell">
<div class="inner">
<div class="circle"></div>
<div class="caption">
<h2>text</h2>
<h3>sub</h3>
</div>
</div>
</div>
</div>
I'm new-ish to Flexbox and trying to build a responsive table-based calendar with round background colors on certain cells. The problem I'm encountering is that since each cell's width is dynamic and on wider (most) screen sizes, the backgrounds are ovals, not circles. How can I set them as circles without disturbing the current layout or using fixed sizes?
As a bonus, I'd also like to be able to dynamically align the date/year with the far-left column.
CSS:
.table {
display: flex;
flex-flow: column nowrap;
box-pack: justify;
justify-content: space-between;
width: 100%;
height: 250px;
}
.table .table-row {
display: flex;
flex-flow: row nowrap;
width: 100%;
}
.table .table-row .table-cell {
display: flex;
padding: 5px;
flex-flow: row nowrap;
flex-grow: 1;
flex-basis: 0;
word-wrap: break-word;
overflow-wrap: break-word;
word-break: break-word;
justify-content: center;
}
.table .table-row .event-on {
border-radius: 100%;
background-color: grey;
}
Markup:
<section id="event-calendar">
<div id="calendar-left">
<div id="calendar-left-cont">
<h1>December 2016</h1>
<div class="table">
<div class="table-row table-header">
<div class="table-cell">S</div>
<div class="table-cell">M</div>
<div class="table-cell">T</div>
<div class="table-cell">W</div>
<div class="table-cell">T</div>
<div class="table-cell">F</div>
<div class="table-cell">S</div>
</div>
<div class="table-row">
<div class="table-cell"></div>
<div class="table-cell"></div>
<div class="table-cell event-on">1</div>
<div class="table-cell">2</div>
<div class="table-cell">3</div>
<div class="table-cell">4</div>
<div class="table-cell">5</div>
</div>
<div class="table-row">
<div class="table-cell">6</div>
<div class="table-cell">7</div>
<div class="table-cell">8</div>
<div class="table-cell">9</div>
<div class="table-cell">10</div>
<div class="table-cell">11</div>
<div class="table-cell">12</div>
</div>
<div class="table-row">
<div class="table-cell">13</div>
<div class="table-cell">14</div>
<div class="table-cell">15</div>
<div class="table-cell">16</div>
<div class="table-cell">17</div>
<div class="table-cell">18</div>
<div class="table-cell">19</div>
</div>
<div class="table-row">
<div class="table-cell">20</div>
<div class="table-cell">21</div>
<div class="table-cell">22</div>
<div class="table-cell">23</div>
<div class="table-cell">24</div>
<div class="table-cell">25</div>
<div class="table-cell">26</div>
</div>
<div class="table-row">
<div class="table-cell">27</div>
<div class="table-cell">28</div>
<div class="table-cell">29</div>
<div class="table-cell">30</div>
<div class="table-cell"></div>
<div class="table-cell"></div>
<div class="table-cell"></div>
</div>
</div>
</div>
</div>
</section>
Pen: http://codepen.io/ourcore/pen/rWbjYZ.
Thanks!
Added a pseudo element and add some styling to it.
.table {
display: flex;
flex-flow: column nowrap;
box-pack: justify;
justify-content: space-between;
width: 100%;
height: 250px;
}
.table .table-row {
display: flex;
flex-flow: row nowrap;
width: 100%;
}
.table .table-row .table-cell {
display: flex;
padding: 5px;
flex-flow: row nowrap;
flex-grow: 1;
flex-basis: 0;
word-wrap: break-word;
overflow-wrap: break-word;
word-break: break-word;
justify-content: center;
}
.table .table-row .event-on {
border-radius: 100%;
position: relative;
}
div.table-cell.event-on::before {
content: '';
width: 25px;
height: 25px;
background-color: grey;
position: absolute;
z-index: -9;
left: 10px;
left: 0;
right: 0;
margin: auto;
top: 0;
bottom: 0;
border-radius: 13px;
}
<section id="event-calendar">
<div id="calendar-left">
<div id="calendar-left-cont">
<h1>December 2016</h1>
<div class="table">
<div class="table-row table-header">
<div class="table-cell">S</div>
<div class="table-cell">M</div>
<div class="table-cell">T</div>
<div class="table-cell">W</div>
<div class="table-cell">T</div>
<div class="table-cell">F</div>
<div class="table-cell">S</div>
</div>
<div class="table-row">
<div class="table-cell"></div>
<div class="table-cell"></div>
<div class="table-cell event-on">1</div>
<div class="table-cell">2</div>
<div class="table-cell">3</div>
<div class="table-cell">4</div>
<div class="table-cell">5</div>
</div>
<div class="table-row">
<div class="table-cell">6</div>
<div class="table-cell">7</div>
<div class="table-cell">8</div>
<div class="table-cell">9</div>
<div class="table-cell">10</div>
<div class="table-cell">11</div>
<div class="table-cell">12</div>
</div>
<div class="table-row">
<div class="table-cell">13</div>
<div class="table-cell">14</div>
<div class="table-cell">15</div>
<div class="table-cell">16</div>
<div class="table-cell">17</div>
<div class="table-cell">18</div>
<div class="table-cell">19</div>
</div>
<div class="table-row">
<div class="table-cell">20</div>
<div class="table-cell">21</div>
<div class="table-cell">22</div>
<div class="table-cell">23</div>
<div class="table-cell">24</div>
<div class="table-cell">25</div>
<div class="table-cell">26</div>
</div>
<div class="table-row">
<div class="table-cell">27</div>
<div class="table-cell">28</div>
<div class="table-cell">29</div>
<div class="table-cell">30</div>
<div class="table-cell"></div>
<div class="table-cell"></div>
<div class="table-cell"></div>
</div>
</div>
</div>
</div>
</section>
Used a <span> and ...
<s> for past days
<i> for event
<b> for important event
Changed .table-cell flex-flow to column nowrap and added align-items:center
CODEPEN