Media queries with CSS in WordPress - css

I am using a theme with wordpress 3.8. I have included some touch effects in my code that I would like to turn off for tablet and phone devices. I've created a new css without hover effects and put it in my main style sheet under:
#media all and (max-width: 699px) and (min-width: 520px)
However it does not seem to be working. I have seen posts Media Queries CSS along with several other posts on the topic but I cannot get it to work correctly. Any suggestions?
Original CSS:
.view {
width: 300px;
height: 200px;
margin: 10px;
float: left;
border: 10px solid #fff;
overflow: hidden;
position: relative;
text-align: center;
box-shadow: 1px 1px 2px #e6e6e6;
cursor: default;
background: #fff url(../images/bgimg.jpg) no-repeat center center
}
.view .mask, .view .content {
width: 300px;
height: 200px;
position: absolute;
overflow: hidden;
top: 0;
left: 0
}
.view img {
display: block;
height: 100%;
max-width: 100%;
vertical-align: middle;
height: max;
padding: 10px 20px 20px;
position: relative
}
.view h2 {
text-transform: uppercase;
color: #fff;
text-align: center;
position: relative;
font-size: 17px;
padding: 10px;
background: rgba(0, 0, 0, 0.8);
margin: 20px 0 0 0
}
.view p {
font-family: Georgia, serif;
font-style: italic;
font-size: 12px;
position: relative;
color: #fff;
padding: 10px 20px 20px;
text-align: center
}
.view a.info {
display: inline-block;
text-decoration: none;
padding: 7px 14px;
background: #000;
color: #fff;
text-transform: uppercase;
box-shadow: 0 0 1px #000
}
.view a.info:hover {
box-shadow: 0 0 5px #000
}
.view-first img {
transition: all 0.2s linear;
}
.view-first .mask {
opacity: 0;
background-color: rgba(219,127,8, 0.7);
transition: all 0.4s ease-in-out;
}
.view-first h2 {
transform: translateY(-100px);
opacity: 0;
transition: all 0.2s ease-in-out;
}
.view-first p {
transform: translateY(100px);
opacity: 0;
transition: all 0.2s linear;
}
.view-first a.info{
opacity: 0;
transition: all 0.2s ease-in-out;
}
.view-first:hover img {
transform: scale(1.1);
}
.view-first:hover .mask {
opacity: 1;
}
.view-first:hover h2,
.view-first:hover p,
.view-first:hover a.info {
opacity: 1;
transform: translateY(0px);
}
.view-first:hover p {
transition-delay: 0.1s;
}
.view-first:hover a.info {
transition-delay: 0.2s;
}
media css
#media only screen and (min-device-width: 340px) {
.view {
width: 300px;
height: 200px;
margin: 10px;
float: left;
border: 10px solid #fff;
overflow: hidden;
position: relative;
text-align: center;
box-shadow: 1px 1px 2px #e6e6e6;
cursor: default;
background: #fff url(../images/bgimg.jpg) no-repeat center center
}
.view .mask, .view .content {
width: 300px;
height: 200px;
position: absolute;
overflow: hidden;
top: 0;
left: 0
}
.view img {
display: block;
height: 100%;
max-width: 100%;
vertical-align: middle;
height: max;
padding: 10px 20px 20px;
position: relative
}
.view h2 {
text-transform: uppercase;
color: #fff;
text-align: center;
position: relative;
font-size: 17px;
padding: 10px;
background: rgba(0, 0, 0, 0.8);
margin: 20px 0 0 0
}
.view p {
font-family: Georgia, serif;
font-style: italic;
font-size: 12px;
position: relative;
color: #fff;
padding: 10px 20px 20px;
text-align: center
}
.view a.info {
display: inline-block;
text-decoration: none;
padding: 7px 14px;
background: #000;
color: #fff;
text-transform: uppercase;
box-shadow: 0 0 1px #000
}
.view a.info {
box-shadow: 0 0 5px #000
}
.view-first img {
transition: all 0.2s linear;
}
.view-first .mask {
opacity: 0;
background-color: rgba(219,127,8, 0.7);
transition: all 0.4s ease-in-out;
}
.view-first h2 {
transform: translateY(-100px);
opacity: 0;
transition: all 0.2s ease-in-out;
}
.view-first p {
transform: translateY(100px);
opacity: 0;
transition: all 0.2s linear;
}
.view-first a.info{
opacity: 0;
transition: all 0.2s ease-in-out;
}
.view-first img {
transform: scale(1.1);
}
.view-first .mask {
opacity: 1;
}
.view-first h2,
.view-first p,
.view-first:hover a.info {
opacity: 1;
transform: translateY(0px);
}
.view-first p {
transition-delay: 0.1s;
}
.view-first a.info {
transition-delay: 0.2s;

this works.
#media only screen and (max-device-width: 340px)
Using #media and removing the hover selectors from your css code allows the hover effects to show up on tablets and phones. This is a simple solution and negates the need to use any javascript to make your css work on touchscreen devices.

Possible duplicate: #Media min-width & max-width
instead of all and use only screen and and instead of max-width use min-device-width This should solve your issue
EDIT:
For example you can't do this:
Original:
.view a.info:hover {
box-shadow: 0 0 5px #000
}
New:
.view a.info {
box-shadow: 0 0 5px #000
}
It will still have the HOVER because it's in the original file and it will use it.. What you can do is change the original to affect all screens other then the ones you want changed..
For example:
Screen with min size of 500px will have HOVER effect and here you add:
.view a.info:hover {
box-shadow: 0 0 5px #000
}
but for second media screen so anything under 500
.view a.info{
box-shadow: 0 0 5px #000
}
This would work... Now in your case you can try have a HOVER but keep it blank inside

#media only screen and (max-width: 768px) {p{color:orange;}}
#media only screen and (min-width: 770px) {p{color:green;}}

Related

How to show full width image on mobile

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.

CSS Wiping animation on exit

I have an animation that wipes from left to right on hover here. I want to have an exit animation that also goes from left to right (not right to left as shown in the demo). How can I achieve this?
.btn {
color: #31302B;
background: #FFF;
margin: 25px;
padding: 10px 0;
width: 240px;
border: 3px solid #31302B;
font-size: 14px;
font-weight: bold;
letter-spacing: 1px;
text-transform: uppercase;
border-radius: 2px;
display: inline-block;
text-align: center;
cursor: pointer;
box-shadow: inset 0 0 0 0 #6a0dad;
-webkit-transition: all ease 0.8s;
-moz-transition: all ease 0.8s;
transition: all ease 0.8s;
}
.btn:hover {
box-shadow: inset 240px 0 0 0 #6a0dad;
color: #fff;
}
<div class="btn">CONTAINER</div>
You could use #keyframes:
.btn {
color: #31302B;
background: #FFF;
margin: 25px;
padding: 10px 0;
width: 240px;
border: 3px solid #31302B;
font-size: 14px;
font-weight: bold;
letter-spacing: 1px;
text-transform: uppercase;
border-radius: 2px;
display: inline-block;
text-align: center;
cursor: pointer;
animation: out 0.8s ease;
}
#keyframes in {
from {
box-shadow: inset 0 0 0 0 #6a0dad;
color: black;
}
to {
box-shadow: inset 240px 0 0 0 #6a0dad;
color: white;
}
}
#keyframes out {
from {
box-shadow: inset -240px 0 0 0 #6a0dad;
color: white;
}
to {
box-shadow: inset 0 0 0 0 #6a0dad;
color: black;
}
}
.btn:hover {
animation: in 0.8s ease;
box-shadow: inset 240px 0 0 0 #6a0dad;
color: white;
}
<div class="btn">CONTAINER</div>
I would suggest using pseudo-element ::after and transform-origin for this.
.btn::after {
z-index: -1;
content: '';
position: absolute;
left: 0;
top: 0;
background: #6a0dad;
height: 100%;
width: 100%;
transform: scaleX(0);
transition: all ease 0.8s;
transform-origin: left;
}
.btn:hover {
color: white;
}
.btn:hover::after {
transform: scaleX(1);
transform-origin: right;
}
Add position: relative; z-index: 1; to .btn class
A simple background transition can easily do this without keyframes:
.btn {
color: #31302B;
background: #FFF;
margin: 25px;
padding: 10px 0;
width: 240px;
border: 3px solid #31302B;
font-size: 14px;
font-weight: bold;
letter-spacing: 1px;
text-transform: uppercase;
border-radius: 2px;
display: inline-block;
text-align: center;
cursor: pointer;
background:linear-gradient(#6a0dad,#6a0dad) left/0% 100% no-repeat;
transition: all ease 0.5s,background-position 0s 0.5s;
}
.btn:hover {
background-size:100% 100%;
background-position:right;
color: #fff;
}
<div class="btn">CONTAINER</div>
Related: How to animate underline from left to right?

Target CSS transition at pseudo-element "Arrow"?

I have a DIV with an "arrow" at the bottom, not unlike a speech bubble from a comic book, which appears on the hover state:
The arrow is created with the :after and :before pseudo elements.
I have a transition for the hover for the border color and the box shadow.
My problem is that the "arrow" just "appears". No fade like the other items, but I can't figure out how to target the "arrow". "All" does not look right either.
Ideally, I'd love to have a delay on the arrow and a simple fade or wipe.
Here's the CSS:
.item-selector-button {
position: relative;
text-align: center;
cursor: pointer;
border: 1px solid #cecece;
padding: 15px;
border-radius: 0;
color: #000;
width: 160px;
height: 120px;
transition: all ease-in-out 0.1s, box-shadow ease-in-out 0.1s;
}
.item-selector-button .title {
color: #3e53a4;
font-size: 12px;
margin: 0;
padding-top: -3px;
font-family: "PrecisionSans_W_Md", "Helvetica Neue", Arial, sans-serif;
}
.item-selector-button .divider {
height: 1px;
width: 20px;
background-color: #cecece;
margin: 4px auto 10px;
}
.item-selector-button .image {
background: #fff url("../images/box.png") center center no-repeat;
width: 64px;
height: 57px;
margin: 4px auto;
}
.item-selector-button:hover, .item-selector-button.hover {
padding: 14px;
}
.item-selector-button:hover:after, .item-selector-button.hover:after {
content: "";
position: absolute;
bottom: -12px;
left: 68px;
border-width: 12px 12px 0;
border-style: solid;
border-color: #fff transparent;
transition-delay: 0.3s;
}
.item-selector-button:hover:before, .item-selector-button.hover:before {
content: "";
position: absolute;
bottom: -15px;
left: 65px;
border-width: 15px 15px 0;
border-style: solid;
border-color: #3e53a4 transparent;
transition-delay: 0.3s;
}
.item-selector-button:active, .item-selector-button.active {
border-width: 2px;
border-color: #3e53a4;
background-color: #3e53a4;
}
.item-selector-button:active:before, .item-selector-button.active:before {
content: "";
position: absolute;
bottom: -15px;
left: 65px;
border-width: 15px 15px 0;
border-style: solid;
border-color: #3e53a4 transparent;
transition-delay: 0.3s;
}
.item-selector-button:active .title, .item-selector-button.active .title {
color: #fff;
}
.item-selector-button:active .divider, .item-selector-button.active .divider {
background-color: #fff;
}
.item-selector-button:active .image, .item-selector-button.active .image {
background-color: #3e53a4;
}
.item-selector-button:active:hover, .item-selector-button.active:hover {
padding: 15px;
box-shadow: none;
}
.item-selector-button:active:hover:after, .item-selector-button.active:hover:after {
content: "";
position: absolute;
bottom: -12px;
left: 68px;
border-width: 12px 12px 0;
border-style: solid;
border-color: #3e53a4 transparent;
transition-delay: 0.3s;
}
.item-selector-button.disabled {
pointer-events: none;
cursor: not-allowed;
}
.item-selector-button.disabled .title {
color: #c3c3c3;
}
.item-selector-button.disabled .image {
background-image: url("../images/box-disabled.png");
}
.item-selector-button.disabled:hover {
padding: 15px;
border: 1px solid #cecece;
box-shadow: none;
}
You only have pseudoelements on the hovered element, so there is nothing to transition from/to. You need to add the pseudo elements on the non-hover state element.
Example transitioning visibility:
.item-selector-button:before {
.arrow-inside(...);
transition:all 5s ease;
transition-delay: 0.3s;
visibility:hidden;
}
.item-selector-button:after {
.arrow-outside(...);
transition:all 5s ease;
transition-delay: 0.3s;
visibility:hidden;
}
.item-selector-button:hover:before {
visibility:visible;
}
.item-selector-button:hover:after {
visibility:visible;
}

Using Body direction rtl with FlexSlider carousel causing blank div

My website Direction(attribute in body) is RTL.
When i'm trying to implement the FlexSlider it's causing the div to be blank.
Like this -
Blanck div
But if im just removing the RTL attribute from the body it's arrange perfectly like this:
arrange fine
The question is how can i bypass it? I just cant figure it out.. i tried change the Flex css but still no good..
this is the css :
/*
* jQuery FlexSlider v2.2.0
* http://www.woothemes.com/flexslider/
*
* Copyright 2012 WooThemes
* Free to use under the GPLv2 license.
* http://www.gnu.org/licenses/gpl-2.0.html
*
* Contributing author: Tyler Smith (#mbmufffin)
*/
/* Browser Resets
*********************************/
.flex-container a:active,
.flexslider a:active,
.flex-container a:focus,
.flexslider a:focus {outline: none;}
.slides,
.flex-control-nav,
.flex-direction-nav {margin: 0; padding: 0; list-style: none;}
/* Icon Fonts
*********************************/
/* Font-face Icons */
#font-face {
font-family: 'flexslider-icon';
src:url('fonts/flexslider-icon.eot');
src:url('fonts/flexslider-icon.eot?#iefix') format('embedded-opentype'),
url('fonts/flexslider-icon.woff') format('woff'),
url('fonts/flexslider-icon.ttf') format('truetype'),
url('fonts/flexslider-icon.svg#flexslider-icon') format('svg');
font-weight: normal;
font-style: normal;
}
/* FlexSlider Necessary Styles
*********************************/
.flexslider {margin: 0; padding: 0;}
.flexslider .slides > li {display: none; -webkit-backface-visibility: hidden; text-align:right;direction:rtl;} /* Hide the slides before the JS is loaded. Avoids image jumping */
.flexslider .slides img {max-width: 232px;
height: 118px;
margin: 0 auto;
display: block;
border-radius: 5px;
margin-bottom: 5px;}
.flex-pauseplay span {text-transform: capitalize;}
/* Clearfix for the .slides element */
.slides:after {content: "."; display: block; clear: both; visibility: hidden; line-height: 0; height: 0;}
html[xmlns] .slides {display: block;}
* html .slides {height: 1%;}
/* No JavaScript Fallback */
/* If you are not using another script, such as Modernizr, make sure you
* include js that eliminates this class on page load */
.no-js .slides > li:first-child {display: block;}
/* FlexSlider Default Theme
*********************************/
.flexslider { margin: 0 0 60px; background: #fff; border: 4px solid #fff; position: relative; -webkit-border-radius: 4px; -moz-border-radius: 4px; -o-border-radius: 4px; border-radius: 4px; -webkit-box-shadow: 0 1px 4px rgba(0,0,0,.2); -moz-box-shadow: 0 1px 4px rgba(0,0,0,.2); -o-box-shadow: 0 1px 4px rgba(0,0,0,.2); box-shadow: 0 1px 4px rgba(0,0,0,.2); zoom: 1; }
.flex-viewport { max-height: 2000px; -webkit-transition: all 1s ease; -moz-transition: all 1s ease; -o-transition: all 1s ease; transition: all 1s ease; }
.loading .flex-viewport { max-height: 300px; }
.flexslider .slides { zoom: 1; }
/* Direction Nav */
.flex-direction-nav {*height: 0;}
.flex-direction-nav a { text-decoration:none; display: block; width: 40px; height: 40px; margin: -20px 0 0; position: absolute; top: 50%; z-index: 10; overflow: hidden; opacity: 0; cursor: pointer; color: #a5d4ff; text-shadow: 1px 1px 0 rgba(255,255,255,0.3); -webkit-transition: all .3s ease; -moz-transition: all .3s ease; transition: all .3s ease; }
.flex-direction-nav .flex-prev { left: -50px; }
.flex-direction-nav .flex-next { right: -50px; text-align: right; }
.flexslider:hover .flex-prev { opacity: 0.7; left: 10px; }
.flexslider:hover .flex-next { opacity: 0.7; right: 10px; }
.flexslider:hover .flex-next:hover, .flexslider:hover .flex-prev:hover { opacity: 1; }
.flex-direction-nav .flex-disabled { opacity: 0!important; filter:alpha(opacity=0); cursor: default; }
.flex-direction-nav a:before { font-family: "flexslider-icon"; font-size: 40px; line-height:1; display: inline-block; content: '\f001'; }
.flex-direction-nav a.flex-next:before { content: '\f002'; }
/* Pause/Play */
.flex-pauseplay a { display: block; width: 20px; height: 20px; position: absolute; bottom: 5px; left: 10px; opacity: 0.8; z-index: 10; overflow: hidden; cursor: pointer; color: #000; }
.flex-pauseplay a:before { font-family: "flexslider-icon"; font-size: 20px; display: inline-block; content: '\f004'; }
.flex-pauseplay a:hover { opacity: 1; }
.flex-pauseplay a.flex-play:before { content: '\f003'; }
/* Control Nav */
.flex-control-nav {width: 100%; position: absolute; bottom: -40px; text-align: center;}
.flex-control-nav li {margin: 0 6px; display: inline-block; zoom: 1; *display: inline;}
.flex-control-paging li a {width: 11px; height: 11px; display: block; background: #666; background: rgba(0,0,0,0.5); cursor: pointer; text-indent: -9999px; -webkit-border-radius: 20px; -moz-border-radius: 20px; -o-border-radius: 20px; border-radius: 20px; -webkit-box-shadow: inset 0 0 3px rgba(0,0,0,0.3); -moz-box-shadow: inset 0 0 3px rgba(0,0,0,0.3); -o-box-shadow: inset 0 0 3px rgba(0,0,0,0.3); box-shadow: inset 0 0 3px rgba(0,0,0,0.3); }
.flex-control-paging li a:hover { background: #333; background: rgba(0,0,0,0.7); }
.flex-control-paging li a.flex-active { background: #000; background: rgba(0,0,0,0.9); cursor: default; }
.flex-control-thumbs {margin: 5px 0 0; position: static; overflow: hidden;}
.flex-control-thumbs li {width: 25%; float: left; margin: 0;}
.flex-control-thumbs img {width: 100%; display: block; opacity: .7; cursor: pointer;}
.flex-control-thumbs img:hover {opacity: 1;}
.flex-control-thumbs .flex-active {opacity: 1; cursor: default;}
#media screen and (max-width: 860px) {
.flex-direction-nav .flex-prev { opacity: 1; left: 10px;}
.flex-direction-nav .flex-next { opacity: 1; right: 10px;}
}
You can use this updated version of FlexSlider that has RTL support: https://github.com/layalk/FlexSlider
$('#flexslider').flexslider({rtl:true});
You also need to include the flexslider-rtl.css file after the flexslider.css file.

Evolve wordpress theme, sizing the header

I am using a premium wordpress theme for a quick website I'm making. Almost everything can be set in the admin panel, which is great, but the header size is not one of them and I find it to be a bit large now. I'd like to use the 'custom css' section in the admin panel because I'm not interested in creating a whole child theme for just that one line of code.
I tried searching for the right class, something is making this thing so big, but what?
This is the url to the page I'm talking about;
http://lindenmobileappstore.nl/drsachs/
This is all the css regarding the header (that I could find at least);
/* 3.2. Header and subheader
==================================== */
#dp-head-wrap {background:transparent; position:relative;
border-bottom: 1px solid rgba(255, 255, 255, 0.2);
z-index:400;
}
.page-template-template-contact-php #dp-head-wrap.semi-transparent {
background-color: rgba(33, 51, 68, 0.9)!important;}
#dp-head {
position: relative;padding: 0 10px;
}
#dp-head:after {
clear: both;
content: "";
display: table;
}
#dp-head h1 {
float: left;
margin: 0;
}
#dp-head a.cssLogo {
background: transparent url('../images/logo.png') no-repeat 0 0;
display: block;
height: 42px;
width: 143px;
text-indent: -9999px;
margin: 30px 15px 10px 0;
background-size:cover;
}
#dp-head a.textLogo {
color: #5F8CB4;
display: block;
font-size: 18px;
line-height: 22px;
padding: 7px 0 0 10px;
}
#dp-head a.textLogo small {
color: #333;
display: block;
font-size: 12px;
line-height: 12px;
}
#dp-head a.imageLogo {
display: block;
width: 160px;
height:42px;
margin: 30px 15px 10px 0;
}
#dp-head a.imageLogo img {
display: block;
width: auto;
height: auto;
max-height: 100%;
height : 100%\9; /*hack: fixes ie8 logo*/
}
.dp-header-wrapper {
background-color: #232D37;
padding: 0;
color:#fff;
position:relative;
}
#dp-header {padding: 20px 0}
#dp-header .box {margin-bottom:0}
#dp-button-area {
float: right;
margin-left: 30px;
}
#dp-button-area a {
display: block;
float: right;
margin: 42px 0 0 0;
-webkit-transition: background-color .3s ease-out;
-moz-transition: background-color .3s ease-out;
-ms-transition: background-color .3s ease-out;
transition: background-color .3s ease-out;
width:25px;
height:25px;
text-align:center;
vertical-align:middle;
color: #2d3e52;
}
#dp-header-search, #dp-logout, #dp-login {
color: #2d3e52;
font-size:18px;
display:block;
line-height:18px;
}
#dp-header-search:hover, #dp-login:hover, #dp-logout:hover {color:#5F8CB4;}
#dp-header-search-form {width:100%;
height:100%;
position:absolute;
top:0;
display:none;
background:#ffffff;
z-index:1000;}
#dp-header-search-form .dp-page {padding:50px 10px 0 10px}
#dp-header-search-form #s {
width:95%;
border:none;line-height:36pxpx;
font-size: 36px;
height:50px!important;
font-weight: 300;
color: #b9bec3;
letter-spacing: 0px;
float:left;
padding:7px 0;
background:transparent;
}
#cancel-search {float:right; width:40px; height:40px;
cursor:pointer;
-webkit-transition: all 0.5s ease-in-out;
-moz-transition: all 0.5s ease-in-out;
-o-transition: all 0.5s ease-in-out;
-ms-transition: all 0.5s ease-in-out;
transition: all 0.5s ease-in-out;color:#b9bec3 }
#cancel-search i {font-size:40px; text-align: center;line-height:40px;}
#cancel-search:hover {
transform:rotate(360deg);
-ms-transform:rotate(360deg);
-webkit-transform:rotate(360deg);
}
.dp-subheader-wraper {
background: #213344;
padding: 0;
}
.dp-subheader {position:relative; height:120px;}
.dp-subheader .main-title {margin:0; padding:25px 0 0 10px; font-size:36px;font-weight:100;line-height:40px}
.dp-subheader .sub-title {margin:0; padding:0 0 0 10px; font-size:13px; font-weight:400; opacity:0.7;}
.dp-subheader .dp-breadcrumbs {position:absolute;right:15px;top:45px;font-size:13px;}
.dp-subheader .dp-breadcrumbs a, .dp-subheader .dp-breadcrumbs span {opacity:0.7}
.dp-subheader .dp-breadcrumbs a:hover {opacity:1}
.sf-menu li {
height: 100px;
}
Remove menu item height and overall height will be based on logo image.

Resources