Skip to content

Instantly share code, notes, and snippets.

@betsydupuis
Last active September 9, 2018 18:19
Show Gist options
  • Save betsydupuis/3ec434e1c93527a4198768bd47cd58d7 to your computer and use it in GitHub Desktop.
Save betsydupuis/3ec434e1c93527a4198768bd47cd58d7 to your computer and use it in GitHub Desktop.
Flexbox Ruled Text
h1.text-center Flexbox Ruled Text
br
h2.text-hr.text-box Horizontal Ruled Text
h2.text-hr.text-right.text-box Horizontal Ruled Text
h2.text-hr.text-left.text-box Horizontal Ruled Text
h2.text-vr.text-box Vertical Ruled Text*
h2.text-vr.text-top.text-box Vertical Ruled Text*
h2.text-vr.text-bottom.text-box Vertical Ruled Text*
div.text-center
p
small *Requires a declared or inherited height.
$rule-width: 2px;
$text-block-padding: 12px;
.text {
&-box {
height: 120px;
border: 6px solid;
width: 5/8 * 100%;
margin: 0 auto 36px;
}
&-center {
text-align: center;
}
&-right {
text-align: right;
}
&-left {
text-align: right;
}
&-vr {
display: flex;
flex-direction: column;
align-content: center;
justify-content: center;
flex-wrap: nowrap;
align-items: center;
min-height: 100%;
&:before, &:after {
content: "";
border-left: $rule-width solid;
height: 100%;
flex: 1 1 0%;
}
&:before {
margin-bottom: $text-block-padding;
}
&:after {
margin-top: $text-block-padding;
}
&.text-top {
&:before {
flex: 0;
}
}
&.text-bottom {
&:after {
flex: 0;
}
}
}
&-hr {
display: flex;
align-content: center;
justify-content: center;
flex-wrap: nowrap;
align-items: center;
flex-direction: row;
&:before, &:after {
content: "";
border-top: $rule-width solid;
width: 100%;
flex: 1 1 0%;
}
&:before {
margin-right: $text-block-padding;
}
&:after {
margin-left: $text-block-padding;
}
&.text-right {
&:after {
flex: 0;
}
}
&.text-left {
&:before {
flex: 0;
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment