<h2 class="title">Flexbox Example</h2>
<div class="flexbox">
<p class="third-paragraph">In code, that means we have a User model, a Team model and a pivot table that establishes the connection between the two models.</p>
<p>Since, most of the time this structure is present, it’s time to roll out a simple solution for handling roles that stored in the pivot table.</p>
</div>
<h2 class="title">Block Formatting Context Example</h2>
<div class="padding">
<div style="display: inline-block;"></div>
<p class="third-paragraph">In code, that means we have a User model, a Team model and a pivot table that establishes the connection between the two models.</p>
<p>Since, most of the time this structure is present, it’s time to roll out a simple solution for handling roles that stored in the pivot table.</p>
</div>
<h2 class="title">Padding Example</h2>
<div class="padding">
<p class="third-paragraph">In code, that means we have a User model, a Team model and a pivot table that establishes the connection between the two models.</p>
<p>Since, most of the time this structure is present, it’s time to roll out a simple solution for handling roles that stored in the pivot table.</p>
</div>
<h2 class="title">Border Example</h2>
<div class="border">
<p class="third-paragraph">In code, that means we have a User model, a Team model and a pivot table that establishes the connection between the two models.</p>
<p>Since, most of the time this structure is present, it’s time to roll out a simple solution for handling roles that stored in the pivot table.</p>
</div>
:root {
box-sizing: border-box;
}
*,
::before,
::after {
box-sizing: inherit;
}
body {
font-family: 'Lato', sans-serif;
padding: 40px;
font-size: 120%;
line-height: 1.5;
color: #565656;
}
p,
.title {
position: relative;
margin: 20px 0;
// margin-top display helper
&::before {
content: 'margin-top';
color: rgba(0,0,0,0.4);
font-size: 14px;
position: absolute;
top: -20px;
right: 0;
left: 0;
background: rgba(167, 63, 188, 0.2);
display: block;
height: 20px;
line-height: 20px;
padding: 0 10px;
}
// margin-bottom display helper
&::after {
content: 'margin-bottom';
color: rgba(0,0,0,0.4);
font-size: 14px;
position: absolute;
bottom: -20px;
right: 0;
left: 0;
background: rgba(63, 188, 162, 0.3);
display: block;
height: 20px;
line-height: 20px;
padding: 0 10px;
text-align: right;
}
}
.first-paragraph {
margin-bottom: 40px;
// margin-bottom display helper
&::after {
height: 40px;
line-height: 40px;
bottom: -40px;
}
}
.second-paragraph {
margin-top: 30px;
// margin-top display helper
&::before {
height: 30px;
line-height: 30px;
top: -30px;
}
}
.third-paragraph {
margin-top: 60px;
// margin-top display helper
&::before {
height: 60px;
line-height: 60px;
top: -60px;
}
}
.title {
margin-top: 80px;
margin-bottom: 30px;
// margin-top display helper
&::before {
height: 80px;
line-height: 80px;
top: -80px;
}
// margin-bottom display helper
&::after {
height: 30px;
line-height: 30px;
bottom: -30px;
}
}
div {
background: rgba(255, 255, 0, 0.15);
}
.flexbox {
display: flex;
flex-wrap: wrap;
p {
width: 100%;
}
}
.padding {
padding: 2px 0;
}
.border {
border: 1px solid red;
}
View Compiled
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.