<picture class="nps screenshot">
<source media="(min-width: 414px)" srcset="https://picsum.photos/1080/720">
<img src="https://picsum.photos/seed/picsum/500/300">
</picture>
<div class="nps formContainer transitionOut">
<form class="nps form">
<img class="nps coverImage" src="https://picsum.photos/seed/picsum/500/200" />
<h1 class="nps h1">Tell us what you think</h1>
<h2 class="nps h2">How satisfied are you with Redbubble, today?</h2>
<div class="nps scaleDescription">
<span><i>💩</i> Not satisfied</span>
<span><i>❤️</i> Very satisfied</span>
</div>
<div class="nps scale">
<input class="nps input" name="number" type="radio" id="one" />
<label class="nps label" for="one">1</label>
<input class="nps input" name="number" type="radio" id="two" />
<label class="nps label" for="two">2</label>
<input class="nps input" name="number" type="radio" id="three" />
<label class="nps label" for="three">3</label>
<input class="nps input" name="number" type="radio" id="four" />
<label class="nps label" for="four">4</label>
<input class="nps input" name="number" type="radio" id="five" />
<label class="nps label" for="five">5</label>
</div>
<h3 class="nps h3">Tell us why?</h3>
<textarea class="nps textarea" rows="5" placeholder="Placeholder"></textarea>
<label class="nps textareaLabel">
<input type="checkbox" />
Rebubble may contact me about my feedback.
</label>
<div class="nps actions">
<a class="nps close">Cancel</a>
<a class="nps button">Submit</a>
</div>
</form>
</div>
<a class="nps floatingActionButton">🎤 Feedback</a>
* {
box-sizing: border-box;
position: relative;
margin: 0;
padding: 0;
}
html {
width: 100%;
min-height: 100%;
font-size: 14px;
}
@media (min-width: 321px) {
html {
font-size: 16px;
}
}
body {
min-height: 100%;
font-size: 1rem;
font-family: sans-serif;
}
.page {
display: flex;
flex-direction: column;
}
.artboards {
display: flex;
justify-content: space-around;
flex-wrap: wrap;
}
.artboardTitle {
font-size: 1rem;
font-weight: bold;
margin: 1rem 0;
}
.artboard {
display: flex;
flex-direction: column;
margin: 1rem;
}
.screen {
background-color: white;
border: 1px solid black;
background-color: #ECEFF1;
}
.screen.iPhone4 {
width: 320px;
height: 480px;
}
.screen.iPhone5 {
width: 320px;
height: 568px;
}
.screen.iPhone6, .screen.iPhone7 {
width: 375px;
height: 667px;
}
.screen.iPhonePlus {
width: 414px;
height: 736px;
}
iframe {
width: 100%;
height: 100%;
border: none;
}
.nps.screenshot img {
width: 100%;
height: auto;
}
.nps.formContainer {
position: fixed;
width: 100%;
z-index: 1;
top: 0;
left: 0;
width: 100%;
height: 100%;
overflow-y: scroll;
-webkit-overflow-scrolling: touch;
}
@media (min-width: 736px) {
.nps.formContainer {
width: 414px;
height: auto;
top: inherit;
right: 1rem;
bottom: 1rem;
left: inherit;
border-radius: 0.5rem;
box-shadow: 0 0.5rem 3rem rgba(0, 0, 0, 0.33);
}
}
.nps.formContainer.transitionOut {
display: none;
}
.nps.formContainer.transitionIn {
display: block;
}
.nps.form {
position: relative;
display: flex;
flex-direction: column;
background-color: white;
width: 100%;
min-height: 100%;
padding-bottom: 1rem;
}
.nps.coverImage {
width: 100%;
height: auto;
padding-bottom: 0.5rem;
box-sizing: content-box;
}
.nps.h1 {
font-size: 1.25rem;
font-weight: bold;
line-height: 1.2;
color: #263238;
padding-top: 1rem;
padding-right: 1rem;
padding-bottom: 0.25rem;
padding-left: 1rem;
}
.nps.h2,
.nps.h3 {
font-size: 1rem;
font-weight: normal;
line-height: 1.2;
color: #263238;
padding-top: 0.25rem;
padding-right: 1rem;
padding-bottom: 0.5rem;
padding-left: 1rem;
}
.nps.h3 {
padding-top: 1rem;
padding-bottom: 0;
font-weight: bold;
}
.nps.scaleDescription {
display: flex;
justify-content: space-between;
padding-top: 1rem;
padding-right: 1rem;
padding-left: 1rem;
font-size: 1rem;
color: #607D8B;
}
.nps.scaleDescription span {
display: flex;
align-items: center;
justify-content: center;
}
.nps.scaleDescription i {
margin-right: 0.25rem;
}
.nps.scale {
display: flex;
height: 2.5rem;
border-radius: 4px;
padding: 0.5rem 1rem;
box-sizing: content-box;
}
.nps.label {
display: flex;
align-items: center;
justify-content: center;
text-align: center;
flex-grow: 1;
cursor: pointer;
color: #40354E;
border-color: #40354E;
border-style: solid;
border-top-width: 1px;
border-bottom-width: 1px;
border-right-width: 1px;
border-left-width: 0;
}
.nps.label[for=one] {
border-left-width: 1px;
border-radius: 0.25rem 0 0 0.25rem;
}
.nps.label[for=five] {
border-radius: 0 0.25rem 0.25rem 0;
}
.nps.input {
display: none;
}
.nps.input:checked + label {
background-color: #40354E;
color: white;
font-weight: bold;
}
.nps.textarea {
margin-top: 0.5rem;
margin-right: 1rem;
margin-bottom: 0.5rem;
margin-left: 1rem;
font-size: 1rem;
padding: 0.5rem;
border-radius: 0.25rem;
font-weight: normal;
color: #263238;
border: 1px solid #90A4AE;
}
.nps.textarea::-moz-placeholder {
color: #607D8B;
}
.nps.textarea:-ms-input-placeholder {
color: #607D8B;
}
.nps.textarea::placeholder {
color: #607D8B;
}
.nps.textareaLabel {
display: flex;
align-items: center;
margin-top: 0.5rem;
margin-right: 1rem;
margin-bottom: 0.5rem;
margin-left: 1rem;
font-size: 0.875rem;
color: #607D8B;
cursor: pointer;
}
.nps.textareaLabel input {
margin-right: 0.25rem;
}
.nps.actions {
display: flex;
justify-content: space-between;
padding-top: 1rem;
}
.nps.close {
display: flex;
flex-direction: column;
text-align: center;
align-items: center;
justify-content: center;
padding: 0 1rem;
height: 2.5rem;
font-size: 1rem;
text-decoration: none;
font-weight: bold;
color: #000;
font-weight: bold;
font-size: 1rem;
line-height: 1;
cursor: pointer;
}
.nps.button {
background-color: #000;
height: 2.5rem;
color: white;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
text-align: center;
font-weight: normal;
font-size: 1rem;
padding: 0 1rem;
margin-left: 1rem;
margin-right: 1rem;
border-radius: 2.5rem;
box-shadow: none;
border: none;
cursor: pointer;
}
.nps.floatingActionButton {
position: fixed;
bottom: 1rem;
right: 1rem;
z-index: 0;
cursor: pointer;
min-width: 2.5rem;
height: 2.5rem;
border-radius: 1.5rem;
background-color: #000;
color: white;
font-weight: normal;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
text-align: center;
border: none;
box-shadow: 0 0.5rem 3rem rgba(0, 0, 0, 0.25);
font-size: 1rem;
padding: 0 1rem;
}
.nps.floatingActionButton:focus {
outline: 0;
}
.nps.floatingActionButton.thankYou {
background-color: #00c853;
transform: scale(0);
-webkit-animation: thankYou ease-in-out 1200ms 150ms forwards;
animation: thankYou ease-in-out 1200ms 150ms forwards;
}
@-webkit-keyframes thankYou {
0% {
transform: scale(0);
}
25% {
transform: scale(1.1);
}
50% {
transform: scale(0.9);
}
75% {
transform: scale(1.05);
}
100% {
transform: scale(1);
}
}
@keyframes thankYou {
0% {
transform: scale(0);
}
25% {
transform: scale(1.1);
}
50% {
transform: scale(0.9);
}
75% {
transform: scale(1.05);
}
100% {
transform: scale(1);
}
}
$(window).load( function() {
$(".nps.floatingActionButton").click( function() {
$(".nps.formContainer").addClass("transitionIn").removeClass("transitionOut");
$(this).removeClass("thankYou")
});
$(".nps.close").click( function() {
$(".nps.formContainer").addClass("transitionOut").removeClass("transitionIn");
$(".nps.floatingActionButton").text("🎤 Feedback").removeClass("thankYou");
});
$(".nps.button").click( function() {
setTimeout(function(){
$(".nps.floatingActionButton").fadeOut();
}, 3000);
$(".nps.floatingActionButton").addClass("thankYou").text("Thank you ❤️");
$(".nps.formContainer").addClass("transitionOut").removeClass("transitionIn");
});
});
This Pen doesn't use any external CSS resources.