div.form-wrapper
.form
.header
h1 Let's work together.
p.intro Just a little form to showcase how you can use DL, DT & DD to spice up your select boxes.
select(name="menu-163" placeholder="Project" aria-invalid="false").btr-form-control.btr-select
option(value="Option 1" disabled selected) Project type...
option(value="Option 2") Web
option(value="Option 3") App
option(value="Option 4") Branding
option(value="Option 5") SEO
textarea(placeholder="Message" rows="1").message
button.submit
.inner Submit.
View Compiled
@import 'https://fonts.googleapis.com/css?family=Raleway:300,400,500,900,700,300|Montserrat:300,400,700';
$size: 20px;
$on: #33afff;
$hlight: #2cffce;
$off: #444;
$selected: rgba(255, 255, 255, 1);
$background: linear-gradient(310deg, #5823fb, #9058bd, #24b2fb, #24fba8);
$main_font: "Montserrat", "Helvetica Neue", Helvetica, Arial, sans-serif;
body {
font-family: $main_font;
color: #fff;
background: linear-gradient(310deg, #5823fb, #9058bd, #24b2fb, #24fba8);
background-size: 600% 600%;
position: relative;
transition: all 0.3s ease-in-out;
animation: oscillateBG 10s ease infinite;
width: 100vw;
height: 100vh;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
}
.form-wrapper {
padding: 0 5vw 6vw;
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
position: relative;
z-index: 10;
.form {
max-width: 468px;
margin: auto;
text-align: center;
.header {
padding: 0 30px;
}
}
p {
color: #aaa;
font-weight: 300;
margin-bottom: 30px;
text-align: justify;
}
h1 {
color: #fff;
font-weight: 700;
font-size: 66px;
line-height: 62px;
text-align: left;
span {
&:first-child {
color: #ea9078;
}
&:nth-child(2) {
color: #65c3ad;
}
}
}
}
button {
background: transparent;
outline: none;
user-select: none;
cursor: not-allowed;
display: block;
color: #fff;
border: 0;
font-family: $main_font;
font-size: 24px;
line-height: 1em;
margin: 20px 0 50px;
&.submit {
padding-left: 28px;
.inner {
position: relative;
display: block;
&:before {
content: "";
position: absolute;
width: calc(100% - 8px);
height: 3px;
background-color: #fff;
top: 0;
left: 0;
opacity: 0;
transition: all 0.25s ease-in-out;
}
}
&:hover {
.inner {
&:before {
opacity: 1;
transform: translate(0, 30px);
}
}
}
}
}
p.intro {
font-family: $main_font;
text-align: left;
font-weight: 300;
color: rgba(255, 255, 255, 0.5);
line-height: 1.5em;
font-size: 0.9em;
letter-spacing: 0.1em;
//text-rendering: geometric-precision;
}
/**
/$$$$$$ /$$$$$$$$ /$$ /$$$$$$$$ /$$$$$$ /$$$$$$$$ /$$$$$$
/$$__ $$| $$_____/| $$ | $$_____/ /$$__ $$|__ $$__//$$__ $$
| $$ \__/| $$ | $$ | $$ | $$ \__/ | $$ | $$ \__/
| $$$$$$ | $$$$$ | $$ | $$$$$ | $$ | $$ | $$$$$$
\____ $$| $$__/ | $$ | $$__/ | $$ | $$ \____ $$
/$$ \ $$| $$ | $$ | $$ | $$ $$ | $$ /$$ \ $$
| $$$$$$/| $$$$$$$$| $$$$$$$$| $$$$$$$$| $$$$$$/ | $$ | $$$$$$/
\______/ |________/|________/|________/ \______/ |__/ \______/
**/
select.btr-select {
display: none;
}
.btr-select {
width: 100%;
cursor: pointer;
position: relative;
margin: 0 0 30px;
text-align: left;
color: #fff;
}
dl.btr-select dt {
width: 100%;
box-sizing: border-box;
color: inherit;
padding: 18px 25px;
position: relative;
line-height: 1.2em;
font-size: 18px;
font-weight: 300;
border: solid 5px rgba(0, 0, 0, 0.3);
box-shadow: 10px 10px 0 rgba(0, 0, 0, 0.3);
border-radius: 50px;
&::after {
content: "";
position: absolute;
width: 10px;
height: 10px;
border-right: solid 3px #fff;
border-bottom: solid 3px #fff;
right: 20px;
top: calc(50% - 9px);
transform: rotate(45deg);
z-index: 2;
&.open {
&::after {
transform: rotate(225deg);
top: calc(50% - 7px);
z-index: 1;
opacity: 0;
}
}
}
}
dl.btr-select dd {
position: absolute;
width: 100%;
font-size: 18px;
z-index: 10;
top: 0;
left: 0;
margin: 0;
visibility: hidden;
opacity: 0;
transform: translate(0px, 0px);
ul {
list-style: none;
margin: 0;
padding: 18px;
box-shadow: 10px 10px 0 $hlight;
text-align: left;
}
&.open {
visibility: visible;
opacity: 1;
transition: all 0.3s ease-in-out;
margin-bottom: 0px;
transform: translate(10px, 10px);
z-index: 3;
ul {
background: white;
// background: $background;
// background-size: 600vw 600vh;
// animation: oscillateBG 10s ease infinite;
border-radius: 20px;
list-style: none;
margin: 0;
padding: 18px;
//border: solid 5px $hlight;
box-shadow: 10px 10px 10px rgba(0, 0, 0, 0.13);
text-align: left;
font-weight: 300;
li {
&:first-child {
color: #ccc;
}
width: 100%;
box-sizing: border-box;
color: #777;
padding: 8px;
&:hover {
background-color: #fafafa;
}
}
}
}
}
textarea {
font-family: $main_font;
width: 100%;
box-sizing: border-box;
color: inherit;
padding: 18px 26px;
position: relative;
line-height: 1.2em;
font-size: 18px;
font-weight: 300;
border: solid 5px rgba(0, 0, 0, 0.3);
box-shadow: 10px 10px 0 rgba(0, 0, 0, 0.3);
background: transparent;
outline: none;
user-select: none;
margin-bottom: 30px;
color: #fff;
height: auto;
border-radius: 50px;
&:focus {
border-color: $hlight;
}
}
input::-webkit-input-placeholder {
color: rgba(255, 255, 255, 0.65);
}
textarea::-webkit-input-placeholder {
color: rgba(255, 255, 255, 0.65);
}
@keyframes oscillateBG {
0% {
background-position: 0% 50%;
}
50% {
background-position: 100% 50%;
}
100% {
background-position: 0% 50%;
}
}
View Compiled
var textarea = document.querySelector('textarea');
textarea.addEventListener('keydown', autosize);
function autosize(){
var el = this;
var elh = $(this).outerHeight();
setTimeout(function(){
el.style.cssText = 'height:auto;';
// for box-sizing other than "content-box" use:
//el.style.cssText = '-moz-box-sizing:content-box';
el.style.cssText = 'height:' + el.scrollHeight + 'px;' + 'min-height:' + elh + 'px;';
},0);
}
function simpleSelect() {
"use strict";
var selectHolder,
selectClass;
//Setup
$('select').each(function() {
if( ! $(this).attr('multiple') ){
selectClass = $(this).attr('class');
selectHolder = '<dl class="simpleSelect '+selectClass+'">';
selectHolder += '<dt>'+$('option', this).first().text()+'</dt><dd><ul>';
$('option', this).each(function() {
selectHolder += '<li data="'+$(this).val()+'">'+$(this).text()+'</li>';
});
selectHolder += '</ul></dd></dl>';
$(this).after(selectHolder);
$('.'+selectClass).wrapAll('<div class="selectContainer"></div>');
}else{
$(this).show();
}
});
$('.simpleSelect dd ul li').on("click",function(){
$(this).parents().eq(3).find('select').val($(this).attr('data'));
});
$('.simpleSelect dt').on("click",function() {
if($(this).next('dd').hasClass("open")){
$(this).removeClass("open").next('dd').removeClass("open");
}
else {
$(this).addClass("open").next('dd').addClass("open");
}
});
$('.simpleSelect dd ul li').on("click",function() {
$(this).parents().eq(1).removeClass("open");
$(this).parents().eq(2).find('dt').removeClass("open");
$(this).parents().eq(4).find('dt').text($(this).text());
});
}
$( document ).ready( simpleSelect );
This Pen doesn't use any external CSS resources.