Last active
January 19, 2018 18:22
-
-
Save Illizion/b8dd28fd21983a668a49ef6a171a4d61 to your computer and use it in GitHub Desktop.
semantic OR button groups for bootstrap
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous"> | |
<div class="btn-group choice mt-5"> | |
<button class="btn btn-danger" role="button">Cancel</button> | |
<div class="or"></div> | |
<button class="btn btn-success" role="button">Save</button> | |
</div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> 1% | |
last 2 versions |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ---- | |
// Sass (v3.4.21) | |
// Compass (v1.0.3) | |
// ---- | |
$or-btn-padding: 1rem; | |
.btn-group.choice{ | |
&:first-child{ | |
padding-right: $or-btn-padding; | |
} | |
.or { | |
position: relative; | |
width: 0.3em; | |
height: 2.57142857em; | |
z-index: 3; | |
&:before{ | |
position: absolute; | |
text-align: center; | |
border-radius: 500rem; | |
content: 'or'; | |
top: 50%; | |
left: 50%; | |
background-color: #FFFFFF; | |
text-shadow: none; | |
margin-top: -0.89285714em; | |
margin-left: -0.89285714em; | |
width: 1.78571429em; | |
height: 1.78571429em; | |
line-height: 1.78571429em; | |
color: rgba(0, 0, 0, 0.4); | |
font-style: normal; | |
font-weight: bold; | |
box-shadow: 0px 0px 0px 1px transparent inset; | |
} | |
&[data-text]:before { | |
content: attr(data-text); | |
} | |
} | |
&:last-child{ | |
padding-left: $or-btn-padding; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.btn-group.choice:first-child { padding-right: 1rem; } | |
.btn-group.choice .or { position: relative; width: 0.3em; height: 2.57142857em; z-index: 3; } | |
.btn-group.choice .or:before { position: absolute; text-align: center; border-radius: 500rem; content: 'or'; top: 50%; left: 50%; background-color: #FFFFFF; text-shadow: none; margin-top: -0.89285714em; margin-left: -0.89285714em; width: 1.78571429em; height: 1.78571429em; line-height: 1.78571429em; color: rgba(0, 0, 0, 0.4); font-style: normal; font-weight: bold; box-shadow: 0px 0px 0px 1px transparent inset; } | |
.btn-group.choice .or[data-text]:before { content: attr(data-text); } | |
.btn-group.choice:last-child { padding-left: 1rem; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous"> | |
<div class="btn-group choice mt-5"> | |
<button class="btn btn-danger" role="button">Cancel</button> | |
<div class="or"></div> | |
<button class="btn btn-success" role="button">Save</button> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment