Related
i have a button with shadow around. The shadow is in an extra class.
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: consolas;
min-height: 100%;
}
body {
font-family: 'Anonymous Pro', monospace;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
background: #C7DEFA;
position: relative;
}
.btn {
position: relative;
width: 66px;
height: 50px;
display: flex;
justify-content: center;
align-items: center;
right: -500px;
}
.btn::before {
content: '';
position: absolute;
top: 0;
left: 0;
width: 10px;
height: 100%;
background: linear-gradient(#fff, #fff, #F9FCFF);
z-index: 1;
filter: blur(1px);
}
.btn::after {
content: '';
position: absolute;
top: 0;
right: -1px;
width: 10px;
height: 100%;
background: #9CA6B1;
z-index: 1;
filter: blur(1px);
}
.btn-after {
position: relative;
width: 100%;
height: 100%;
border: none;
padding: 10px 25px;
outline: none;
background: linear-gradient(#D8E8FC, #B2C2D5);
box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.1), 15px 15px 15px rgba(0, 0, 0, 0.1), 20px 20px 15px rgba(0, 0, 0, 0.1), 30px 30px 15px rgba(0, 0, 0, 0.1), inset 1px 1px 2px #fff;
}
.shadow {
position: absolute;
top: 0;
left: -50px;
width: calc(100% + 50px);
height: 300px;
background: linear-gradient(180deg, rgba(0, 0, 0, 0.1), transparent, transparent);
transform-origin: top;
transform: skew(45deg);
pointer-events: none;
}
.shadow::before {
content: '';
position: absolute;
width: 50px;
height: 50px;
background: #C7DEFA;
z-index: 1;
}
<body>
<div class="btn">
<div class="shadow"></div>
</div>
</body>
What I need help with is, to disable the .shadow class while btn:active. So there would be no shadow if the btn is clicked. It should look like a keyboard button with shadow when not clicked and without shadow when clicked.
Thx alot!
CSS is only for styling purpose and it cannot modify the document itself (elements, classes, etc.). If you do not want a certain style, you have to work around that - by putting more constraints to restrict the style to apply, for example, only when it is not clicked.
:not(:active) may be what you want. However, normal elements do not handle :active selector, and thus I changed the order of the element and used .btn-after:not(:active) + .shadow to apply shadow only when the link is not active.
See :active and Adjacent sibling combinator(+) for more info.
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: consolas;
min-height: 100%;
}
body {
font-family: 'Anonymous Pro', monospace;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
background: #C7DEFA;
position: relative;
}
.btn {
position: relative;
width: 66px;
height: 50px;
display: flex;
justify-content: center;
align-items: center;
}
.btn::before {
content: '';
position: absolute;
top: 0;
left: 0;
width: 10px;
height: 100%;
background: linear-gradient(#fff, #fff, #F9FCFF);
z-index: 1;
filter: blur(1px);
}
.btn::after {
content: '';
position: absolute;
top: 0;
right: -1px;
width: 10px;
height: 100%;
background: #9CA6B1;
z-index: 1;
filter: blur(1px);
}
.btn-after {
position: relative;
width: 100%;
height: 100%;
border: none;
padding: 10px 25px;
outline: none;
background: linear-gradient(#D8E8FC, #B2C2D5);
box-shadow: 5px 5px 5px rgba(0, 0, 0, 0.1),
15px 15px 15px rgba(0, 0, 0, 0.1),
20px 20px 15px rgba(0, 0, 0, 0.1),
30px 30px 15px rgba(0, 0, 0, 0.1),
inset 1px 1px 2px #fff;
}
.btn-after:not(:active)+.shadow {
position: absolute;
top: 0;
left: -50px;
width: calc(100% + 50px);
height: 300px;
background: linear-gradient(180deg, rgba(0, 0, 0, 0.1),
transparent, transparent);
transform-origin: top;
transform: skew(45deg);
pointer-events: none;
z-index: -2;
}
.btn-after:not(:active)+.shadow::before {
content: '';
position: absolute;
width: 50px;
height: 50px;
background: #C7DEFA;
z-index: -1;
}
<html>
<body>
<div class="btn">
<div class="shadow"></div>
</div>
</body>
</html>
hey guys i´ve got a problem here, im building a website with a freee template and i ran into a problem, while i was doing the las few touches, i ran into a problem, my images from the slider dont appear as full width on mobile like in desktop, could you help me pls?
much appreciated, here is the code
body {
background: #fff;
font-family: "Open Sans", Arial, sans-serif;
font-weight: 400;
font-size: 16px;
line-height: 1.8;
color: #868e96;
}
.img-fluid{
width: 255px;
height: 255px;
object-fit: cover;
}
a {
-webkit-transition: .3s all ease;
-o-transition: .3s all ease;
transition: .3s all ease;
text-decoration: none;
}
a:hover {
text-decoration: none;
}
h1, h2, h3, h4, h5 {
color: #000;
}
.btn, .form-control {
outline: none;
-webkit-box-shadow: none !important;
box-shadow: none !important;
}
/* Header */
header {
position: relative;
top: 0;
left: 0;
width: 100%;
z-index: 5;
}
header .navbar-brand {
text-transform: uppercase;
letter-spacing: .2em;
font-weight: 400;
}
header .navbar-brand span {
color: #007bff;
}
header .top-bar {
background: #007bff;
}
header .top-bar a {
color: #fff;
padding: 10px;
font-size: 13px;
display: inline-block;
}
header .top-bar .cta-btn {
display: inline-block;
padding-right: 15px;
padding-left: 15px;
background: #5AC8D8;
}
header .top-bar .cta-btn:hover {
-webkit-box-shadow: 2px 0 20px 0 rgba(0, 0, 0, 0.1);
box-shadow: 2px 0 20px 0 rgba(0, 0, 0, 0.1);
}
header .top-bar .social {
margin-bottom: 0;
}
header .top-bar .social li {
display: inline-block;
text-align: center;
}
header .top-bar .social li a {
color: #fff;
padding: 10px;
width: 40px;
display: inline-block;
}
#media (max-width: 991px) {
header .top-bar .social li a {
padding-left: 10px;
padding-right: 10px;
width: inherit;
}
}
header .top-bar .social li a:hover {
background: #5AC8D8;
color: #fff;
-webkit-box-shadow: 2px 0 20px 0 rgba(0, 0, 0, 0.1);
box-shadow: 2px 0 20px 0 rgba(0, 0, 0, 0.1);
}
header .navbar {
padding-top: 0;
padding-bottom: 0;
background: white !important;
}
#media (max-width: 1199px) {
header .navbar {
background: white !important;
padding-top: .5rem;
padding-bottom: .5rem;
}
}
header .navbar .nav-link {
padding: 1.7rem 1rem;
outline: none !important;
}
#media (max-width: 1199px) {
header .navbar .nav-link {
padding: .5rem 0rem;
}
}
header .navbar .nav-link.active {
color: #007bff !important;
}
header .navbar .dropdown-menu {
font-size: 14px;
border-radius: 4px;
border: none;
-webkit-box-shadow: 0 2px 20px -5px rgba(0, 0, 0, 0.1);
box-shadow: 0 2px 20px -5px rgba(0, 0, 0, 0.1);
}
header .navbar .dropdown-menu .dropdown-item.active {
background: #f8f9fa;
color: #007bff !important;
}
header .navbar .dropdown-menu a {
padding-top: 7px;
padding-bottom: 7px;
}
/* Owl Carousel */
.owl-carousel .owl-item {
opacity: .4;
}
.owl-carousel .owl-item.active {
opacity: 1;
}
.owl-carousel .owl-nav {
position: absolute;
top: 50%;
width: 100%;
}
.owl-carousel .owl-nav .owl-prev,
.owl-carousel .owl-nav .owl-next {
position: absolute;
-webkit-transform: translateY(-50%);
-ms-transform: translateY(-50%);
transform: translateY(-50%);
margin-top: -10px;
}
.owl-carousel .owl-nav .owl-prev span:before,
.owl-carousel .owl-nav .owl-next span:before {
font-size: 40px;
}
.owl-carousel .owl-nav .owl-prev {
left: 30px !important;
}
.owl-carousel .owl-nav .owl-next {
right: 30px !important;
}
.owl-carousel .owl-dots {
text-align: center;
}
.owl-carousel .owl-dots .owl-dot {
width: 10px;
height: 10px;
margin: 5px;
border-radius: 50%;
background: #e6e6e6;
}
.owl-carousel .owl-dots .owl-dot.active {
background: #007bff;
}
.owl-carousel.home-slider {
z-index: 1;
position: relative;
}
.owl-carousel.home-slider .owl-nav {
opacity: 0;
visibility: hidden;
-webkit-transition: .3s all ease;
-o-transition: .3s all ease;
transition: .3s all ease;
}
.owl-carousel.home-slider .owl-nav button {
color: #fff;
}
.owl-carousel.home-slider:focus .owl-nav, .owl-carousel.home-slider:hover .owl-nav {
opacity: 1;
visibility: visible;
}
.owl-carousel.home-slider .slider-item {
background-size:cover;
background-repeat: no-repeat;
background-position: center center;
}
.owl-carousel.home-slider .slider-item .slider-text {
color: #fff;
height: calc(100vh - 117px);
min-height: 700px;
}
.owl-carousel.home-slider .slider-item .slider-text h1 {
font-size: 72px;
color: #fff;
line-height: 1.2;
font-weight: 300;
}
#media (max-width: 991px) {
.owl-carousel.home-slider .slider-item .slider-text h1 {
font-size: 40px;
}
}
.owl-carousel.home-slider .slider-item .slider-text p {
font-size: 20px;
line-height: 1.5;
font-weight: 300;
color: rgba(255, 255, 255, 0.8);
}
.owl-carousel.home-slider.inner-page .slider-item {
height: calc(50vh - 117px);
min-height: 500px;
}
.owl-carousel.home-slider.inner-page .slider-item .slider-text {
color: #fff;
height: calc(50vh - 117px);
min-height: 500px;
}
.owl-carousel.home-slider .owl-dots {
position: absolute;
bottom: 150px;
width: 100%;
}
.owl-carousel.home-slider .owl-dots .owl-dot {
width: 18px;
height: 18px;
margin: 5px;
border-radius: 50%;
background: #e6e6e6;
background: none;
border: 2px solid rgba(255, 255, 255, 0.5);
outline: none !important;
position: relative;
-webkit-transition: .3s all ease;
-o-transition: .3s all ease;
transition: .3s all ease;
}
.owl-carousel.home-slider .owl-dots .owl-dot span {
position: absolute;
width: 6px;
height: 6px;
background: rgba(255, 255, 255, 0.5);
border-radius: 50% !important;
left: 50%;
top: 50%;
display: block;
-webkit-transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}
.owl-carousel.home-slider .owl-dots .owl-dot.active {
border: 2px solid white;
}
.owl-carousel.home-slider .owl-dots .owl-dot.active span {
background: white;
}
.owl-carousel.major-caousel .owl-stage-outer {
padding-top: 30px;
padding-bottom: 30px;
}
.owl-carousel.major-caousel .owl-nav .owl-prev, .owl-carousel.major-caousel .owl-nav .owl-next {
-webkit-transition: .3s all ease;
-o-transition: .3s all ease;
transition: .3s all ease;
color: #495057;
}
.owl-carousel.major-caousel .owl-nav .owl-prev:hover, .owl-carousel.major-caousel .owl-nav .owl-prev:focus, .owl-carousel.major-caousel .owl-nav .owl-next:hover, .owl-carousel.major-caousel .owl-nav .owl-next:focus {
color: #868e96;
outline: none;
}
.owl-carousel.major-caousel .owl-nav .owl-prev.disabled, .owl-carousel.major-caousel .owl-nav .owl-next.disabled {
color: #dee2e6;
}
.owl-carousel.major-caousel .owl-nav .owl-prev {
left: -60px !important;
}
.owl-carousel.major-caousel .owl-nav .owl-next {
right: -60px !important;
}
.owl-carousel.major-caousel .owl-dots {
bottom: -30px !important;
position: relative;
}
.owl-custom-nav {
float: right;
position: relative;
z-index: 10;
}
.owl-custom-nav .owl-custom-prev,
.owl-custom-nav .owl-custom-next {
padding: 10px;
font-size: 30px;
background: #ccc;
line-height: 0;
width: 60px;
text-align: center;
display: inline-block;
}
.home-feature {
margin-top: -120px;
position: relative;
z-index: 2;
}
.home-feature .one-col, .home-feature .two-col, .home-feature .three-col {
position: relative;
-webkit-transition: .3s all ease;
-o-transition: .3s all ease;
transition: .3s all ease;
z-index: 2;
top: 0;
border-bottom: 10px solid #5AC8D8;
}
#media (max-width: 767px) {
.home-feature .one-col, .home-feature .two-col, .home-feature .three-col {
border: none;
margin-bottom: 10px;
}
}
.home-feature .one-col .col-inner, .home-feature .two-col .col-inner, .home-feature .three-col .col-inner {
position: relative;
}
.home-feature .one-col .icon, .home-feature .two-col .icon, .home-feature .three-col .icon {
font-size: 200px;
color: rgba(255, 255, 255, 0.07);
position: absolute;
left: 50%;
top: 50%;
-webkit-transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
z-index: -1;
-webkit-transition: .3s all ease;
-o-transition: .3s all ease;
transition: .3s all ease;
}
.home-feature .one-col h2, .home-feature .two-col h2, .home-feature .three-col h2 {
color: #fff;
font-size: 16px;
letter-spacing: .05em;
font-weight: 300;
margin-bottom: 20px;
text-transform: uppercase;
}
.home-feature .one-col p, .home-feature .two-col p, .home-feature .three-col p {
color: rgba(255, 255, 255, 0.7);
font-weight: 300;
}
.home-feature .one-col p:last-child, .home-feature .two-col p:last-child, .home-feature .three-col p:last-child {
margin-bottom: 0;
}
.home-feature .one-col .btn-more, .home-feature .two-col .btn-more, .home-feature .three-col .btn-more {
-webkit-transition: .15s all ease-out;
-o-transition: .15s all ease-out;
transition: .15s all ease-out;
opacity: 0;
visibility: hidden;
position: absolute;
display: block;
text-align: center;
bottom: -50px;
left: 0;
right: 0;
padding: 20px;
background: #5AC8D8;
z-index: -1;
color: #fff;
-webkit-box-shadow: 0 4px 20px -5px rgba(0, 0, 0, 0.4);
box-shadow: 0 4px 20px -5px rgba(0, 0, 0, 0.4);
}
#media (max-width: 767px) {
.home-feature .one-col .btn-more, .home-feature .two-col .btn-more, .home-feature .three-col .btn-more {
opacity: 1;
visibility: visible;
position: relative;
bottom: 0;
}
}
.home-feature .one-col .btn-more:hover, .home-feature .two-col .btn-more:hover, .home-feature .three-col .btn-more:hover {
background: #6fcfdd;
}
.home-feature .one-col:hover, .home-feature .two-col:hover, .home-feature .three-col:hover {
top: -10px;
z-index: 3;
-webkit-box-shadow: 0 4px 40px -5px rgba(0, 0, 0, 0.4);
box-shadow: 0 4px 40px -5px rgba(0, 0, 0, 0.4);
}
#media (max-width: 767px) {
.home-feature .one-col:hover, .home-feature .two-col:hover, .home-feature .three-col:hover {
top: 0;
}
}
.home-feature .one-col:hover .icon, .home-feature .two-col:hover .icon, .home-feature .three-col:hover .icon {
-webkit-transform: translate(-10px, -50%);
-ms-transform: translate(-10px, -50%);
transform: translate(-10px, -50%);
}
.home-feature .one-col:hover .btn-more, .home-feature .two-col:hover .btn-more, .home-feature .three-col:hover .btn-more {
opacity: 1;
visibility: visible;
bottom: -50px;
}
#media (max-width: 767px) {
.home-feature .one-col:hover .btn-more, .home-feature .two-col:hover .btn-more, .home-feature .three-col:hover .btn-more {
bottom: 0;
}
}
.home-feature .one-col {
background: #007bff;
}
.home-feature .two-col {
background: #006fe6;
}
.home-feature .three-col {
background: #0067d6;
}
.section {
padding: 7em 0;
}
.cta-link {
background: #007bff;
padding: 3.5em 0 3em 0;
display: block;
text-align: center;
}
.cta-link:focus, .cta-link:active {
outline: none;
}
.cta-link span {
line-height: 1.2;
}
.cta-link .sub-heading {
color: #fff;
display: block;
font-size: 20px;
}
.cta-link .heading {
font-size: 50px;
color: #001933;
}
#media (max-width: 991px) {
.cta-link .heading {
font-size: 30px;
}
}
.cta-link:hover {
background: #006fe6;
}
.cover_1 {
background-size: cover;
background-position: center center;
padding: 7em 0;
}
.cover_1 .sub-heading {
color: rgba(255, 255, 255, 0.7);
font-size: 22px;
}
.cover_1 .heading {
font-size: 50px;
color: white;
font-weight: 300;
}
.heading {
color: #000;
}
.heading.border-bottom {
position: relative;
padding-bottom: 30px;
}
.heading.border-bottom:before {
bottom: 0;
position: absolute;
content: "";
width: 50px;
height: 2px;
left: 50%;
-webkit-transform: translateX(-50%);
-ms-transform: translateX(-50%);
transform: translateX(-50%);
background: #007bff;
}
.text-black {
color: #000 !important;
}
.stretch-section .video {
display: block;
position: relative;
-webkit-box-shadow: 4px 4px 70px -20px rgba(0, 0, 0, 0.5);
box-shadow: 4px 4px 70px -20px rgba(0, 0, 0, 0.5);
}
.media-feature .icon {
font-size: 60px;
color: #007bff;
}
.media-feature h3 {
font-size: 20px;
}
.media-custom {
background: #fff;
-webkit-transition: .3s all ease;
-o-transition: .3s all ease;
transition: .3s all ease;
-webkit-box-shadow: 0 2px 3px 0 rgba(0, 0, 0, 0.1);
box-shadow: 0 2px 3px 0 rgba(0, 0, 0, 0.1);
margin-bottom: 30px;
}
.media-custom .meta-post {
color: #adb5bd;
font-size: 13px;
text-transform: uppercase;
}
.media-custom .meta-chat {
color: #ced4da;
}
.media-custom .meta-chat:hover {
color: #868e96;
}
.media-custom:focus, .media-custom:hover {
-webkit-box-shadow: 0 2px 10px 0 rgba(0, 0, 0, 0.2);
box-shadow: 0 2px 10px 0 rgba(0, 0, 0, 0.2);
}
.media-custom .media-body {
padding: 30px;
}
.media-custom .media-body h3 {
font-size: 20px;
}
.media-custom .media-body p:last-child {
margin-bottom: 0;
}
.list-unstyled.check li {
position: relative;
padding-left: 30px;
line-height: 1.3;
margin-bottom: 10px;
}
.list-unstyled.check li:before {
color: #5AC8D8;
left: 0;
font-family: "Ionicons";
content: "\f122";
position: absolute;
}
.custom-tabs .border-right {
border-right: 1px solid #dee2e6;
}
#media (max-width: 767px) {
.custom-tabs .border-right {
border-right: none;
}
}
.custom-tabs .nav-pills .nav-link {
padding-left: 0;
font-size: 26px;
font-weight: 100;
color: #adb5bd;
line-height: 1.2;
margin-bottom: 10px;
}
.custom-tabs .nav-pills .nav-link span {
font-size: 18px;
}
.custom-tabs .nav-pills .nav-link.active {
background: none;
color: #007bff;
padding-left: 20px;
position: relative;
}
.custom-tabs .nav-pills .nav-link.active:before {
content: "";
position: absolute;
top: 10px;
bottom: 10px;
left: 0;
width: 2px;
background: #5AC8D8;
}
.custom-tabs .tab-pane .icon {
font-size: 60px;
display: block;
color: #007bff;
}
.custom-tabs .tab-pane h2 {
font-size: 60px;
font-weight: 300;
}
#modalAppointment .modal-content {
border-radius: 0;
border: none;
}
#modalAppointment .modal-body, #modalAppointment .modal-footer {
padding: 40px;
}
.site-footer {
padding: 7em 0;
background: #f2f2f2;
background: #283E56;
color: rgba(255, 255, 255, 0.7);
}
.site-footer a {
color: rgba(255, 255, 255, 0.5);
}
.site-footer a:hover {
color: white;
}
.site-footer h3 {
color: #fff;
font-size: 16px;
font-weight: 700;
margin-bottom: 30px;
text-transform: uppercase;
letter-spacing: .05em;
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
padding-bottom: 10px;
margin-bottom: 20px;
}
.site-footer .footer-link li {
line-height: 1.3;
margin-bottom: 15px;
}
.site-footer hr {
width: 100%;
}
.site-footer .border-t {
border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.copyright {
font-size: 14px;
}
.element-animate {
opacity: 0;
visibility: hidden;
}
html code:
<section class="home-slider inner-page owl-carousel">
<div class="slider-item" style="background-image: url({{ asset('img/slider-2.jpg') }});">
<div class="container">
<div class="row slider-text align-items-center">
<div class="col-md-7 col-sm-12 element-animate">
<h1>{% trans %}Welcome to Denticlin{% endtrans %}</h1>
</div>
</div>
</div>
</div>
</section>
<!-- END section -->
<section class="section stretch-section">
<div class="container">
<div class="row justify-content-center mb-5 element-animate">
<div class="col-md-8 text-center mb-5">
<h2 class="text-uppercase heading border-bottom mb-4">{% trans %}sdfsdfn{% endtrans %}</h2>
<p class="mb-0 lead">{% trans %}dsfsfs{% endtrans %}</p><br>
<p class="mb-0 lead">{% trans %}Wsdfs.{% endtrans %}</p><br>
<p class="mb-0 lead">{% trans %}sdfsdfn.{% endtrans %}</p><br>
</div>
</div>
</div>
</section>
Please, if possible, provide your HTML code, without it nobody can really tell what is going on.
I have an image with a class of author-pic, its working how I want it to, except on the second to last media query it's stretching horizontally, when display flex is set. I know you're not supposed to use % with children of display flex, however author-pic is not an immediate child, does this mean you cant use % on any children when using display flex? If so how can I fix this because flex-basis doesnt seem to work either, I'm assuming because author-pic isnt an immediate child.
https://jsfiddle.net/svb0gxgg/2/
#media screen and (min-width: 400px){
.author-pic{
min-width: 300px;
width: 25%;
height: 25%;
float: left;
margin: 0 .5em;
}
section h2{
font-size: 1.5em;
}
section h3{
font-size: 1.3em;
}
/***home page***/
.home-page-greeting{
font-size: 1.8rem;
}
.front-of-book-front,
.back-of-book-front,
.book-front,
.book-back,
.book{
width: 113px;
height: 180px;
}
.front-of-book-front:before{
width: 133px;
height: 17px;
transform: translate(8px,105px) rotate(90deg);
-moz-transform: translate(8px,105px) rotate(90deg);
}
.front-of-book-front:after{
width: 83px;
height: 14px;
transform: translate(0,21px);
-moz-transform: translate(0,21px);
}
.bar{
width: 95px;
height: 10px;
background-color: rgba(0,0,0,.8);
font-size: .3em;
color: white;
text-align: right;
transform: rotate(90deg) translate(42px,-45px);
-moz-transform: rotate(90deg) translate(42px,-45px);
}
.book-back p{
font-size: .4rem;
margin: 2.9em 1.9em;
}
.book-side{
width: 176px;
height: 10px;
top:-3px;
}
header{
height: 130px;
display: flex;
justify-content: center;
}
header h1{
font-size: 2em;
align-self: flex-start;
white-space: nowrap;
border: 8px solid black;
}
header nav{
display: block;
align-self: flex-end;
position: initial;
width: initial;
}
.main-nav{
display: flex;
justify-content: flex-end;
width:initial;
}
.main-nav li{
border-radius: 8px;
padding: 5px;
font-size: 1.3rem;
background-color: transparent;
margin: 0 4px;
width:initial;
}
.drop-menu{
top: 34px;
}
.drop-menu li{
margin: 0;
border-radius: 0;
}
/***charactor page*****/
.character-pic{
width: 25%;
height: 25%;
}
}
#media screen and (min-width:860px){
body{
background-position: center;
}
header{
height: 120px;
justify-content: space-between;
}
header h1{
margin: 0 0 0 20px;
}
.main-nav li{
font-size: 1.5rem;
}
header nav{
margin: 0 40px 0 0;
width: initial;
}
.drop-menu{
top: 38px;
}
section h2{
font-size: 1.8em;
}
/***home page***/
.amazonBookLabel{
font-size: 1.5em;
}
/**home page book**/
.front-of-book-front,
.back-of-book-front,
.book-front,
.book-back,
.book{
width: 200px;
height: 320px;
}
.front-of-book-front{
perspective: 200px;
}
.front-of-book-front:before{
width: 234px;
height: 37px;
transform: translate(11px,185px) rotate(90deg);
font-size: 1em;
line-height: 37px;
}
.front-of-book-front:after{
width: 146px;
height: 26px;
transform: translate(0,32px);
}
.bar{
width: 172px;
height: 23px;
background-color: rgba(0,0,0,.8);
font-size: .3em;
color: white;
text-align: right;
transform: rotate(90deg) translate(74px,-82px);
font-size: .7em;
}
.bar p{
display: block;
padding: 12px 5px 0 0;
}
.book-side{
width: 312px;
height: 10px;
top:-1px;
left: -5px;
}
.book-back p{
font-size: .7em;
margin: 3.3em 2.3;
}
/*****author page******/
.authorWrapper{
display: flex;
margin: auto;
}
.authorWrapper :nth-child(1){
flex-basis: 75%;
}
.authorWrapper :nth-child(2){
flex-basis: 25%;
}
}
If you want an image to scale properly you need only use width or only use height. Your image looks weird because you have the height set at 25%. Remove that and it should work. If you need to use both make sure you have the ratio correct, eg 4:3
use align-items. The default value is stretch, which is being applied here. Looks like you want to use flex-start instead.
/*************general*********************/
html,
body {
min-height: 100vh;
}
body {
margin: 0px;
// background-image: linear-gradient( 0, rgba(0,0,0,.8) 30%, rgba(0,150,255,.8) 100%), url("images/mainCover.jpg");
-moz-background-image: linear-gradient( 0, rgba(0, 0, 0, .8) 30%, rgba(0, 150, 255, .8) 100%), url("images/mainCover.jpg");
background-position: 40%;
background-repeat: no-repeat;
background-size: cover;
}
img {
max-width: 100%;
}
h1,
h2,
h3 {
font-family: arial;
text-align: center;
margin: 20px auto;
}
ul {
list-style: none;
text-align: center;
padding: 0;
}
a:visited,
a {
color: black;
}
section {
margin: 1%;
color: white;
}
section > article {
padding: 1em;
background-color: rgba(0, 0, 0, .5);
border-radius: 15px;
margin: 10px;
}
section h2,
section h3 {
text-align: center;
}
section h2 {
font-size: 1.3em;
text-shadow: 3px 3px 3px rgba(0, 0, 0, .5);
}
section h3 {
font-size: 1.1em;
}
article:after {
content: "";
display: block;
clear: both;
}
/*nav and header*/
header {
background-color: rgba(255, 165, 0, .8);
display: flex;
flex-flow: row wrap;
justify-content: center;
border-bottom: 8px solid black;
}
header h1 {
text-align: center;
margin: 0;
padding: 15px;
font-size: 1.5em;
text-shadow: 5px 5px 5px rgba(0, 0, 0, .3);
}
header h1,
nav a {
font-weight: 700;
font-family: arial;
}
header nav {
position: fixed;
bottom: 0;
width: 100%;
z-index: 1;
// background-color: rgba(255,165,0,.8);
}
.main-nav {
margin: 0;
width: 100%;
color: white;
font-family: arial;
font-weight: 600;
}
nav ul li {
text-align: center;
border: 1px solid white;
border-radius: 15px;
font-size: 1.2rem;
background-color: rgba(255, 165, 0, .8);
width: 100%;
}
.drop-menu-back {
display: none;
width: 100%;
}
a {
text-decoration: none;
}
nav a:visited,
nav a,
h1 {
color: white;
}
.main-nav .current-page {
background-color: rgba(0, 0, 0, .5);
}
/****drop down menu****/
.characters:hover {
position: relative;
border-radius: 8px 8px 0 0;
}
.drop-menu {
position: absolute;
visibility: hidden;
display: block;
top: 38px;
white-space: nowrap;
left: -2px;
background-color: rgba(255, 165, 0, .8);
border: 1px solid rgba(0, 0, 0, .02);
box-shadow: 5px 5px 5px 2px rgba(0, 0, 0, .3);
opacity: 0;
transition: opacity 300ms ease-in-out 0s;
z-index: 1;
}
.characters:hover .drop-menu {
visibility: visible;
opacity: 1;
}
/*******************home page*********************/
.home-page-greeting {
color: white;
text-align: center;
text-shadow: 3px 3px 5px rgba(0, 0, 0, 1);
}
.bookWrapper {
width: 25%;
margin: auto;
}
.bookLink {
display: block;
margin: auto;
}
.bookImage {
margin: 35px auto;
display: block;
//max-height: 300px;
}
.amazonBookLabel {
background-color: rgba(0, 0, 0, .5);
color: white;
padding: 10px;
font-weight: 600;
border-radius: 20px;
margin: 30px auto;
text-align: center;
position: relative;
max-width: 200px;
}
.amazonBookLabel:after {
content: "";
width: 30px;
height: 5px;
background-color: rgba(0, 0, 0, .5);
position: absolute;
bottom: -5px;
left: calc(50% - 17px);
}
.amazonBookLabel:before {
content: "";
width: 0;
height: 0;
border-left: 40px solid rgba(0, 0, 0, .5);
border-top: 40px solid transparent;
position: absolute;
bottom: -45px;
transform: rotate(-45deg);
transform-origin: top left;
left: calc(50% - 30px);
}
/***home page book***/
.front-of-book-front,
.back-of-book-front,
.book-front,
.book-back,
.book {
width: 100px;
height: 160px;
position: relative;
perspective: 800px;
}
.book {
margin: 52px auto;
transition: transform 1s ease-in-out 0s;
-moz-transition: transform 1s ease-in-out 0s;
}
.book-front {
position: relative;
transform-style: preserve-3d;
-moz-transform-style: preserve-3d;
transform-origin: left;
-moz-transform-origin: left;
transition: transform 1s ease-in-out 0s;
-moz-transition: transform 1s ease-in-out 0s;
box-shadow: 0px 3px 5px 2px rgba(0, 0, 0, .5);
perspective: 400px;
perspective-origin: -200px;
}
.front-of-book-front {
background-image: url("images/mainCover.jpg");
background-repeat: no-repeat;
background-size: cover;
background-position: 47%;
backface-visibility: hidden;
}
.front-of-book-front:before {
content: "Seraph Chronicles: Evangelion";
text-shadow: 2px 2px 1px rgba(0, 0, 0, .5);
font-size: .5em;
line-height: 15px;
color: white;
width: 119px;
height: 15px;
background-color: rgba(255, 165, 0, .5);
position: absolute;
text-align: center;
transform: translate(8px, 93px) rotate(90deg);
-moz-transform: translate(8px, 93px) rotate(90deg);
}
.front-of-book-front:after {
content: "";
width: 75px;
height: 12px;
background-color: rgba(255, 165, 0, .5);
position: absolute;
transform: translate(0px, 19px);
-moz-transform: translate(0px, 19px);
}
.bar {
width: 80px;
height: 8px;
background-color: rgba(0, 0, 0, .8);
font-size: .3em;
color: white;
text-align: right;
transform: rotate(90deg) translate(36px, -45px);
-moz-transform: rotate(90deg) translate(36px, -45px);
}
.bar p {
padding: 2px 3px 0 0;
display: block;
}
.back-of-book-front {
backface-visibility: hidden;
background-color: rgb(240, 234, 214);
transform: rotateY(180deg);
-moz-transform: rotateY(180deg);
position: absolute;
top: 0;
}
.book-front:hover {
transform: rotatey(-180deg);
}
.book:hover {
transform: rotate(10deg);
}
.book-back {
position: absolute;
top: 0;
background-color: rgb(240, 234, 214);
z-index: -1;
box-shadow: 3px 3px 5px 0 rgba(0, 0, 0, .5);
text-align: justify;
}
.book-back p {
font-size: .3rem;
margin: 2.9em 1.9em;
}
/**********author page********/
.author-pic {
display: block;
margin: auto;
width: 200px;
;
}
section article {
padding: 1em;
background-color: rgba(0, 0, 0, .5);
border-radius: 15px;
margin: 10px;
clear: both;
}
address {
margin: 15px auto;
width: 125px;
font-family: arial;
}
.email {
background-image: url("images/mail-icon.png");
background-repeat: no-repeat;
background-size: contain;
background-position: 0 50%;
}
.email a,
.facebook a,
.email:visited,
.facebook:visited {
color: white;
font-style: normal;
font-weight: 500;
}
address a {
display: block;
line-height: 19px;
}
.facebook {
background-image: url("images/facebook-icon.png");
background-size: contain;
background-repeat: no-repeat;
background-position: 0 50%;
}
/*******characters page********/
.charater-pic {
width: 100%;
}
/***responsive***/
#media screen and (max-width: 400px) {
.drop-menu {
top: -97px;
width: 100%;
}
.drop-menu-back {
display: block;
width: 100%;
position: relative;
line-height: 22px;
}
.characters:hover {
border-radius: 15px;
}
.drop-menu-back span {
padding: 0;
font-size: .8em;
margin: 0 .5em 0 0;
}
.drop-menu {
background-color: transparent;
}
footer {
height: 100px;
}
}
#media screen and (min-width: 400px) {
.author-pic {
min-width: 300px;
width: 25%;
height: 25%;
float: left;
margin: 0 .5em;
}
section h2 {
font-size: 1.5em;
}
section h3 {
font-size: 1.3em;
}
/***home page***/
.home-page-greeting {
font-size: 1.8rem;
}
.front-of-book-front,
.back-of-book-front,
.book-front,
.book-back,
.book {
width: 113px;
height: 180px;
}
.front-of-book-front:before {
width: 133px;
height: 17px;
transform: translate(8px, 105px) rotate(90deg);
-moz-transform: translate(8px, 105px) rotate(90deg);
}
.front-of-book-front:after {
width: 83px;
height: 14px;
transform: translate(0, 21px);
-moz-transform: translate(0, 21px);
}
.bar {
width: 95px;
height: 10px;
background-color: rgba(0, 0, 0, .8);
font-size: .3em;
color: white;
text-align: right;
transform: rotate(90deg) translate(42px, -45px);
-moz-transform: rotate(90deg) translate(42px, -45px);
}
.book-back p {
font-size: .4rem;
margin: 2.9em 1.9em;
}
.book-side {
width: 176px;
height: 10px;
top: -3px;
}
header {
height: 130px;
display: flex;
justify-content: center;
}
header h1 {
font-size: 2em;
align-self: flex-start;
white-space: nowrap;
border: 8px solid black;
}
header nav {
display: block;
align-self: flex-end;
position: initial;
width: initial;
}
.main-nav {
display: flex;
justify-content: flex-end;
width: initial;
}
.main-nav li {
border-radius: 8px;
padding: 5px;
font-size: 1.3rem;
background-color: transparent;
margin: 0 4px;
width: initial;
}
.drop-menu {
top: 34px;
}
.drop-menu li {
margin: 0;
border-radius: 0;
}
/***charactor page*****/
.character-pic {
width: 25%;
height: 25%;
}
}
#media screen and (min-width:860px) {
body {
background-position: center;
}
header {
height: 120px;
justify-content: space-between;
}
header h1 {
margin: 0 0 0 20px;
}
.main-nav li {
font-size: 1.5rem;
}
header nav {
margin: 0 40px 0 0;
width: initial;
}
.drop-menu {
top: 38px;
}
section h2 {
font-size: 1.8em;
}
/***home page***/
.amazonBookLabel {
font-size: 1.5em;
}
/**home page book**/
.front-of-book-front,
.back-of-book-front,
.book-front,
.book-back,
.book {
width: 200px;
height: 320px;
}
.front-of-book-front {
perspective: 200px;
}
.front-of-book-front:before {
width: 234px;
height: 37px;
transform: translate(11px, 185px) rotate(90deg);
font-size: 1em;
line-height: 37px;
}
.front-of-book-front:after {
width: 146px;
height: 26px;
transform: translate(0, 32px);
}
.bar {
width: 172px;
height: 23px;
background-color: rgba(0, 0, 0, .8);
font-size: .3em;
color: white;
text-align: right;
transform: rotate(90deg) translate(74px, -82px);
font-size: .7em;
}
.bar p {
display: block;
padding: 12px 5px 0 0;
}
.book-side {
width: 312px;
height: 10px;
top: -1px;
left: -5px;
}
.book-back p {
font-size: .7em;
margin: 3.3em 2.3;
}
/*****author page******/
.authorWrapper {
display: flex;
margin: auto;
align-items: flex-start;
}
.authorWrapper:nth-child(1) {
flex-basis: 75%;
}
.authorWrapper:nth-child(2) {
flex-basis: 25%;
}
}
#media screen and (min-width: 1109px) {
header h1 {
font-size: 3em;
margin: 0 0 0 80px;
}
.main-nav > li {
margin: 0 8px;
}
header nav {
margin: 0 80px 0 0;
}
/***home page***/
.home-page-greeting {
font-size: 2.5rem;
}
}
<header>
<h1>Seraph Chronicles</h1>
<nav>
<ul class="main-nav">
<li class="main-nav-item">Home</li>
<li class="main-nav-item">About</li>
<li class="main-nav-item characters">
Characters
<ul class="drop-menu">
<li class="drop-menu-back"><span class="material-icons">arrow_back</span>Back</li>
<li>Ethan Clarke</li>
<li>Serena Kiriaga</li>
<li>Marcus Flynn</li>
<li>Emily Ashdown</li>
<li>Director Miles West</li>
</ul>
</li>
<li class="main-nav-item current-page">Author</li>
</ul>
</nav>
</header>
<main>
<section>
<div class="authorWrapper">
<article class="aboutAuthor">
<h2>About the Author</h2>
<img src="http://www.jqueryscript.net/images/Simplest-Responsive-jQuery-Image-Lightbox-Plugin-simple-lightbox.jpg" alt="picture of author, Kyle Feller" class="author-pic">
<p>sd t yghjiu hgfdwert yuikjn dnmkjhjh jhbnjhn jhnjhnmkjn mkjhnjhn mkjhnmkjn mkjn mkwjnedkj njhbnkjnmkj nmkjnm kjnmkjnmkj hnmkjnmk jnmjhbcnk jcbnjkj bnkjnbnk jnkjnnk jnkj nkj nknk jn nkjn bnkjnbnkm nnmknmkmn kjnkmnkjnmkj nmjnjnmk jnmjnmkjnb jxncbcjbnkj
nbnjkjhb njhnbkj njnbnkjnk jnmjhnmjn mkjnmjnm jnjnbnmjnj njhnmkjh nbnjnbnk jnbnjkjnj kjnkjnkjn kjnbnkjnbn kjnbnkj nbnkjn nknbnjnb nkjnbnmnn kjnnmmn kjnkmnkj mnkjnkjn nkjmnkjm nkjmnkm jcncc ncncncncnc ncnc ncnncnc ncncnc
</p>
</article>
<article>
<h2>Contact Me</h2>
<ul>
<li><address class="email">Email Me</address></li>
<li><address class="facebook"> Follow Me</address></li>
</ul>
</article>
</div>
</section>
</main>
<footer>
</footer>
how can I make this effect of the inner side of the lines?This is the menu bar I am trying to make: http://i.stack.imgur.com/Mvuer.jpg I cant do the effect between the lines. This is my code: https://jsfiddle.net/ivailo/3q6ej7cc/4/
.button {
position: relative;
display: inline-block;
padding: .5em 1em;
font-size: 18px;
font-family: Arial, 'Arial Unicode MS', Helvetica, Sans-Serif;
border: 1px solid rgba(122, 112, 82, 0.2);
color: #877B5A;
text-align: center;
text-decoration: none;
outline: none;
overflow: hidden;
border-radius: 7px;
}
.button::after {
position: absolute;
top: 50%;
left: 50%;
z-index: -1;
color #fffff;
display: block;
content: '';
width: 15em;
height: 15em;
border-radius: 50%;
-webkit-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
transition: all 0s;
}
.button:hover::after {
box-shadow: inset 0 0 0 10em rgba(242, 189, 99, .2);
}
.button:hover {
color: #000000;
}
.button1 {
position: relative;
display: inline-block;
padding: .5em 1em;
font-size: 18px;
font-family: Arial, 'Arial Unicode MS', Helvetica, Sans-Serif;
border: 1px solid rgba(122, 112, 82, 0.2);
color: #877B5A;
text-align: center;
text-decoration: none;
outline: none;
overflow: hidden;
border-radius: 7px;
}
.button1::after {
position: absolute;
top: 50%;
left: 50%;
z-index: -1;
display: block;
content: '';
width: 15em;
height: 15em;
transform: translate(-50%, -50%);
transition: all 0s;
}
.button1:hover::after {
box-shadow: inset 0 0 0 10em rgba(242, 189, 99, .2);
}
.button1:hover {
color: #000000;
}
.theborder {
text-align: center;
width: 600px;
padding: 20px 25px;
}
.theborder:after {
content: "";
height: 1px;
background: linear-gradient(to right, rgba(0, 0, 0, 0) 0%, rgba(160, 160, 160, .7) 50%, rgba(0, 0, 0, 0) 100%);
display: block;
margin: 10px 0px;
}
.theborder:before {
content: "";
height: 1px;
background: linear-gradient(to right, rgba(0, 0, 0, 0) 0%, rgba(160, 160, 160, .7) 50%, rgba(0, 0, 0, 0) 100%);
display: block;
margin: 10px 0px;
}
Step 1: The inner glow
You can achieve this effect by using a variant of the curved drop-shadow trick. That trick is explained here:
http://nicolasgallagher.com/css-drop-shadows-without-images/demo/
But instead of putting the shadow behind, we can:
make it white
leave it in front
set overflow: hidden on the menu to hide the parts of the "shadow" we don't want to see.
This produces the interior glow effect that you want.
BODY {
background-color: tan;
}
.menu {
background-color: tan;
width: 500px;
height: 60px;
position: relative;
overflow: hidden;
}
.menu::before {
content: "";
position: absolute;
top: -50%;
bottom: 100%;
left: 10%;
right: 10%;
border-radius: 50% / 30%;
box-shadow: 0 0 50px rgba(255,255,255,0.8);
}
.menu::after {
content: "";
position: absolute;
top: 100%;
bottom: -50%;
left: 10%;
right: 10%;
border-radius: 50% / 30%;
box-shadow: 0 0 40px rgba(255,255,255,0.7);
}
<div class="menu">
</div>
You can see more clearly how it works if you remove the overflow: hidden from the menu rule.
Step 2: The fading top border
To make this we can just add a new <div> element at the top that is 1px height and has a CSS gradient background.
The final result:
BODY {
background-color: tan;
}
.menu {
background-color: tan;
width: 500px;
height: 60px;
position: relative;
overflow: hidden;
}
.menu::before {
content: "";
position: absolute;
top: -50%;
bottom: 100%;
left: 10%;
right: 10%;
border-radius: 50% / 30%;
box-shadow: 0 0 50px rgba(255,255,255,0.8);
}
.menu::after {
content: "";
position: absolute;
top: 100%;
bottom: -50%;
left: 10%;
right: 10%;
border-radius: 50% / 30%;
box-shadow: 0 0 40px rgba(255,255,255,0.7);
}
.topborder {
width: 100%;
height: 1px;
background: linear-gradient(to right, rgba(0,0,0,0) 0%,rgba(0,0,0,0.5) 25%,rgba(0,0,0,0.5) 75%,rgba(0,0,0,0) 100%);
}
<div class="menu">
<div class="topborder"></div>
</div>
Note: in both of the above examples I have simplified things by just using the unprefixed CSS properties. These should work on the latest Chrome and FF at least. But if you need to support older browser versions, you should add the prefixed versions of the CSS properties as well.
For example for the gradients, you might want to add -moz-linear-gradient and -webkit-linear-gradient, plus the fallback filter gradients for older versions of IE.
See: full version of this gradient
I am trying to work on the following example for a user profile.
I have a problem with the text on my various fields though. I would like them to be centered horizontally and vertically.
Using
vertical-align: middle;
Did not work for me, or I did something wrong.
How can I make it so each text snippet is perfectly centered on its respective container?
Here's the solution:
/* --------------------------------
Primary style
-------------------------------- */
#font-face {
font-family: 'Roboto';
src: url('../fonts/roboto/Roboto-Regular.ttf');
font-weight: normal;
font-style: normal;
}
*,
*:before,
*:after {
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
div {
display: block;
}
html,
body {
background: #f1f1f1;
font-family: 'Roboto', sans-serif;
padding: 1em;
}
h1 {
text-align: center;
color: #a8a8a8;
font-size: 200%;
}
.user-data {
-webkit-transition: all 0.2s ease-in-out;
transition: all 0.2s ease-in-out;
position: relative;
overflow: hidden;
cursor: pointer;
display: table;
width: 100%;
height: 85px;
background: white;
margin: 0 auto;
margin-top: 1em;
margin-bottom: 20px;
border-radius: 8px;
-webkit-transition: all 250ms;
transition: all 250ms;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
}
.response-layer {
vertical-align: middle;
display: table-cell;
text-align: center;
font-size: 200%;
color: #a8a8a8;
}
#user-action-text {
color: #f1f1f1;
font-size: 400%;
}
#user-name {
border: 0;
outline: 0;
padding: 0;
margin: 0px;
margin-top: 10px;
width: 304px;
height: 55px;
color: white;
}
#user-action {
background: #e74c3c;
height: 134px;
}
#user-position {
height: 74px;
}
#user-uuid {
height: 54px;
}
section {
max-width: 650px;
text-align: center;
margin: 20px auto;
}
section img {
border: 0;
outline: 0;
padding: 0;
-moz-border-radius: 8px;
-webkit-border-radius: 8px;
border-radius: 8px;
display: block;
width: 100%;
margin-top: 1em;
-webkit-transition: all 250ms;
transition: all 250ms;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
resize: none;
}
.half {
float: left;
width: 48%;
margin-bottom: 1em;
}
.right {
width: 50%;
}
.left {
margin-right: 2%;
}
.user-data:hover {
box-shadow: 0 10px 20px rgba(0, 0, 0, 0.19), 0 6px 6px rgba(0, 0, 0, 0.23);
-webkit-transform: translateY(-5px);
-ms-transform: translateY(-5px);
transform: translateY(-5px);
}
section img:hover {
box-shadow: 0 10px 20px rgba(0, 0, 0, 0.19), 0 6px 6px rgba(0, 0, 0, 0.23);
-webkit-transform: translateY(-5px);
-ms-transform: translateY(-5px);
transform: translateY(-5px);
}
#-webkit-keyframes loading {
0%, 100% {
margin-top: -50px;
box-shadow: 0px 55px 40px 0px rgba(0, 0, 0, 0.3);
}
30%,
80% {
margin-top: 0px;
box-shadow: 0px 0px 0px 0px rgba(0, 0, 0, 0.5);
}
}
#keyframes loading {
0%, 100% {
margin-top: -50px;
box-shadow: 0px 55px 40px 0px rgba(0, 0, 0, 0.3);
}
30%,
80% {
margin-top: 0px;
box-shadow: 0px 0px 0px 0px rgba(0, 0, 0, 0.5);
}
}
#media (max-width: 690px) {
.half {
width: 304px;
float: none;
margin-bottom: 0;
}
}
/* Clearfix */
.activity-detail:before,
.activity-detail:after {
content: " ";
/* 1 */
display: table;
/* 2 */
}
.activity-detail:after {
clear: both;
}
<h1>New Activity Details</h1>
<section class="activity-detail">
<div class="half right" id="image-data">
<img src="img/default-avatar.png" alt="Profile Photo" style="width:304px;height:304px;" id="profile-photo">
<a class="user-data" id="user-name">
<div class="response-layer">Green Leaf</div>
</a>
</div>
<div class="half left" id="general-data">
<a class="user-data" id="user-action">
<div class="response-layer" id="user-action-text">Greetings</div>
</a>
<a class="user-data" id="user-position">
<div class="response-layer">Developer</div>
</a>
<a class="user-data" id="user-uuid">
<div class="response-layer">324124535345</div>
</a>
</div>
</section>
On the parent div .user-data I changed display to table.
On the child div .response-layer (the one containing "Greetings") I changed the display to table-cell. Now the vertical align works.
Here's the link to the codepen: Codepen
Replacing
vertical-align: middle;
with
position: relative;
top: 25%;
does the trick.
Edit: The answer above is much cleaner