https://jsfiddle.net/qd2o38fp/1/
I want the user to be able to hover over the circle, and then click the circle itself to be directed to another link. (not the text when hovered)
.ch-item {
width: 100%;
height: 100%;
border-radius: 50%;
overflow: hidden;
position: relative;
cursor: default;
box-shadow:
inset 0 0 0 16px rgba(255,255,255,0.6),
0 1px 2px rgba(0,0,0,0.1);
transition: all 0.4s ease-in-out;
content: url(www.yahoo.com);
}
I tried to put
content: url(www.yahoo.com);
but this makes the text disappear for some reason.
If you want to be able to click it, it must be a link:
<a href="//www.yahoo.com" class="ch-info">
<h3>See Portfolio</h3>
</a>
Just display it as a block, and your current code will work:
.ch-info {
display: block;
}
.ch-grid {
margin: 20px 0 0 0;
padding: 0;
list-style: none;
display: block;
text-align: center;
width: 100%;
}
.ch-grid::after {
clear: both;
}
.ch-grid li {
width: 220px;
height: 220px;
display: inline-block;
margin: 20px;
}
.ch-item {
width: 100%;
height: 100%;
border-radius: 50%;
overflow: hidden;
position: relative;
cursor: default;
box-shadow: inset 0 0 0 16px rgba(255, 255, 255, 0.6), 0 1px 2px rgba(0, 0, 0, 0.1);
transition: all 0.4s ease-in-out;
}
.ch-img-1 {
background-image: url(http://www.pulsarwallpapers.com/data/media/3/Alien%20Ink%202560X1600%20Abstract%20Background.jpg);
}
.ch-img-2 {
background-image: url(../images/2.jpg);
}
.ch-img-3 {
background-image: url(../images/3.jpg);
}
.ch-info {
position: absolute;
background: rgba(63, 147, 147, 0.8);
width: inherit;
height: inherit;
border-radius: 50%;
overflow: hidden;
opacity: 0;
transition: all 0.4s ease-in-out;
transform: scale(0);
display: block;
}
.ch-info h3 {
color: #fff;
text-transform: uppercase;
letter-spacing: 2px;
font-size: 22px;
margin: 0 30px;
padding: 45px 0 0 0;
height: 140px;
font-family: 'Open Sans', Arial, sans-serif;
text-shadow: 0 0 1px #fff, 0 1px 2px rgba(0, 0, 0, 0.3);
}
.ch-info p {
color: #fff;
padding: 10px 5px;
font-style: italic;
margin: 0 30px;
font-size: 12px;
border-top: 1px solid rgba(255, 255, 255, 0.5);
opacity: 0;
transition: all 1s ease-in-out 0.4s;
}
.ch-info p a {
display: block;
color: rgba(255, 255, 255, 0.7);
font-style: normal;
font-weight: 700;
text-transform: uppercase;
font-size: 9px;
letter-spacing: 1px;
padding-top: 4px;
font-family: 'Open Sans', Arial, sans-serif;
}
.ch-info p a:hover {
color: rgba(255, 242, 34, 0.8);
}
.ch-item:hover {
box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1), 0 1px 2px rgba(0, 0, 0, 0.1);
}
.ch-item:hover .ch-info {
transform: scale(1);
opacity: 1;
}
.ch-item:hover .ch-info p {
opacity: 1;
}
.ch-item::before {
content: "P";
position: absolute;
font-size: 180px;
left: 0px;
top: 0px;
width: 100%;
height: 100%;
}
<ul class="ch-grid">
<li>
<div class="ch-item ch-img-1">
<a href="//www.yahoo.com" class="ch-info">
<h3>See Portfolio</h3>
</a>
</div>
</li>
</ul>
extending Oriol's you could also use clip-path: circle(110px at center);
to limit :hover selection
.ch-grid {
margin: 20px 0 0 0;
padding: 0;
list-style: none;
display: block;
text-align: center;
width: 100%;
}
.ch-grid::after {
clear: both;
}
.ch-grid li {
width: 220px;
height: 220px;
display: inline-block;
margin: 20px;
}
.ch-item {
width: 100%;
height: 100%;
border-radius: 50%;
overflow: hidden;
position: relative;
cursor: default;
box-shadow: inset 0 0 0 16px rgba(255, 255, 255, 0.6), 0 1px 2px rgba(0, 0, 0, 0.1);
transition: all 0.4s ease-in-out;
}
.ch-img-1 {
background-image: url(http://www.pulsarwallpapers.com/data/media/3/Alien%20Ink%202560X1600%20Abstract%20Background.jpg);
}
.ch-img-2 {
background-image: url(../images/2.jpg);
}
.ch-img-3 {
background-image: url(../images/3.jpg);
}
.ch-info {
position: absolute;
background: rgba(63, 147, 147, 0.8);
width: inherit;
height: inherit;
border-radius: 50%;
overflow: hidden;
opacity: 0;
transition: all 0.4s ease-in-out;
transform: scale(0);
display: block;
}
.ch-info h3 {
color: #fff;
text-transform: uppercase;
letter-spacing: 2px;
font-size: 22px;
margin: 0 30px;
padding: 45px 0 0 0;
height: 140px;
font-family: 'Open Sans', Arial, sans-serif;
text-shadow: 0 0 1px #fff, 0 1px 2px rgba(0, 0, 0, 0.3);
}
.ch-info p {
color: #fff;
padding: 10px 5px;
font-style: italic;
margin: 0 30px;
font-size: 12px;
border-top: 1px solid rgba(255, 255, 255, 0.5);
opacity: 0;
transition: all 1s ease-in-out 0.4s;
}
.ch-info p a {
display: block;
color: rgba(255, 255, 255, 0.7);
font-style: normal;
font-weight: 700;
text-transform: uppercase;
font-size: 9px;
letter-spacing: 1px;
padding-top: 4px;
font-family: 'Open Sans', Arial, sans-serif;
clip-path: circle(110px at center);
}
.ch-info p a:hover {
color: rgba(255, 242, 34, 0.8);
clip-path: circle(110px at center);
}
.ch-item:hover {
box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1), 0 1px 2px rgba(0, 0, 0, 0.1);
clip-path: circle(110px at center);
}
.ch-item:hover .ch-info {
transform: scale(1);
opacity: 1;
}
.ch-item:hover .ch-info p {
opacity: 1;
}
.ch-item::before {
content: "P";
position: absolute;
font-size: 180px;
left: 0px;
top: 0px;
width: 100%;
height: 100%;
}
<ul class="ch-grid">
<li>
<div class="ch-item ch-img-1">
<a href="//www.yahoo.com" class="ch-info">
<h3>See Portfolio</h3>
</a>
</div>
</li>
</ul>
Related
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 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?
I want to make this menu bar. I already managed to do the ghost buttons, but how can I make this outline border for the menu:
http://i.stack.imgur.com/wwBVw.jpg
This is my code: https://jsfiddle.net/ivailo/3q6ej7cc/
.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;
}
Check the code below, I enclosed the 2 buttons with a div and styled it to act as a border :-)
.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:before, .theborder:after {
content: "";
height: 1px;
background: linear-gradient(to right, rgba(0,0,0,0) 0%,rgba(160,160,160,1) 50%,rgba(0,0,0,0) 100%);
display: block;
margin : 10px 0px;
}
<div class="theborder">
<a class="button" href="#"> Button </a>
<a class="button1" href="#"> Button1 </a>
</div>
Hello does anyone know why my left green checkbox is not aligned on left of the text ? Here is my code and what I see right now.
I want something like this "V Etendre le linge X" for one row (V is the checkbox and X is the destroy button)
html,
body {
margin: 0;
padding: 0;
}
button {
margin: 0;
padding: 0;
border: 0;
background: none;
font-size: 100%;
vertical-align: baseline;
font-family: inherit;
color: inherit;
-webkit-appearance: none;
-moz-appearance: none;
-ms-appearance: none;
-o-appearance: none;
appearance: none;
}
body {
font: 14px 'Helvetica Neue', Helvetica, Arial, sans-serif;
line-height: 1.4em;
background: #eaeaea url('../bower_components/todomvc-common/bg.png');
color: #4d4d4d;
width: 550px;
margin: 0 auto;
-webkit-font-smoothing: antialiased;
-moz-font-smoothing: antialiased;
-ms-font-smoothing: antialiased;
-o-font-smoothing: antialiased;
font-smoothing: antialiased;
}
.sapUiTv, .sapUiBtnS {
font: inherit;
font-size: inherit;
}
#todoapp {
background: #fff;
background: rgba(255, 255, 255, 0.9);
margin: 130px 0 40px 0;
border: 1px solid #ccc;
position: relative;
border-top-left-radius: 2px;
border-top-right-radius: 2px;
box-shadow: 0 2px 6px 0 rgba(0, 0, 0, 0.2),
0 25px 50px 0 rgba(0, 0, 0, 0.15);
}
#todoapp:before {
content: '';
border-left: 1px solid #f5d6d6;
border-right: 1px solid #f5d6d6;
width: 2px;
position: absolute;
top: 0;
left: 40px;
height: 100%;
}
#todoapp input::-webkit-input-placeholder {
font-style: italic;
}
#todoapp input:-moz-placeholder {
font-style: italic;
color: #a9a9a9;
}
#todoapp h1 {
position: absolute;
top: -120px;
width: 100%;
font-size: 70px;
font-weight: bold;
text-align: center;
color: #b3b3b3;
color: rgba(255, 255, 255, 0.3);
text-shadow: -1px -1px rgba(0, 0, 0, 0.2);
-webkit-text-rendering: optimizeLegibility;
-moz-text-rendering: optimizeLegibility;
-ms-text-rendering: optimizeLegibility;
-o-text-rendering: optimizeLegibility;
text-rendering: optimizeLegibility;
}
#header {
padding-top: 15px;
border-radius: inherit;
}
#main {
position: relative;
z-index: 2;
border-top: 1px dotted #adadad;
}
#new-todo,
.sapUiTfBrd.sapUiTfRo.todo,
.sapUiTfBrd.sapUiTfStd.todo {
position: relative;
margin: 0;
margin-right: 153px;
width: 100%;
font-size: 24px;
font-family: inherit;
line-height: 1.4em;
background-color: transparent;
border: 0;
outline: none;
color: #4D4D4D;
padding: 6px;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
-ms-box-sizing: border-box;
-o-box-sizing: border-box;
box-sizing: border-box;
-webkit-font-smoothing: antialiased;
-moz-font-smoothing: antialiased;
-ms-font-smoothing: antialiased;
-o-font-smoothing: antialiased;
font-smoothing: antialiased;
}
#new-todo {
padding: 15px 15px 16px 60px;
border: none;
background: rgba(0, 0, 0, 0.02);
z-index: 2;
box-shadow: none;
}
#todo-list {
margin: 0;
padding: 0;
list-style: none;
}
#todo-list li {
position: relative;
font-size: 24px;
border-top: 1px dotted #ccc;
}
#todo-list input[type='checkbox'] {
text-align: center;
width: 40px;
/* auto, since non-WebKit browsers doesn't support input styling */
height: auto;
position: absolute;
top: 0;
bottom: 0;
margin: auto 0;
-webkit-appearance: none;
/*-moz-appearance: none;*/
-ms-appearance: none;
-o-appearance: none;
appearance: none;
}
#todo-list input[type='checkbox']:after {
content: '✔';
line-height: 62px;
font-size: 20px;
color: #d9d9d9;
text-shadow: 0 -1px 0 #bfbfbf;
}
#todo-list input[type='checkbox']:checked:after {
color: #85ada7;
text-shadow: 0 1px 0 #669991;
bottom: 1px;
position: relative;
}
#todo-list input:not([type='checkbox']) {
word-break: break-word;
padding: 15px;
margin-left: 45px;
display: block;
line-height: 1.2em;
-webkit-transition: color 0.4s;
-moz-transition: color 0.4s;
-ms-transition: color 0.4s;
-o-transition: color 0.4s;
transition: color 0.4s;
}
#todo-list li .destroy {
outline: none;
background-color: transparent;
display: none;
position: absolute;
top: 0;
right: 10px;
bottom: 0;
width: 40px;
height: 40px;
margin: auto 0;
font-size: 22px;
color: #a88a8a;
-webkit-transition: all 0.2s;
-moz-transition: all 0.2s;
-ms-transition: all 0.2s;
-o-transition: all 0.2s;
transition: all 0.2s;
}
#todo-list li .destroy:hover {
text-shadow: 0 0 1px #000,
0 0 10px rgba(199, 107, 107, 0.8);
-webkit-transform: scale(1.3);
-moz-transform: scale(1.3);
-ms-transform: scale(1.3);
-o-transform: scale(1.3);
transform: scale(1.3);
}
#todo-list li .destroy:after {
content: '✖';
}
#todo-list li:hover .destroy {
display: block;
}
#todo-list .sapUiRrNoData,
#todo-list .sapUiRrPtb,
#todo-list .sapUiRrFtr {
display: none;
}
<html>
<head>
<meta charset="UTF-8"/>
<title>MyTodoList</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<section id = "todoapp">
<header id="header">
<h1>MyTodoList</h1>
<form action="#" id="todo-form">
<input type="text" id="new-todo" placeholder="New task" autofocus autocomplete="off">
</form>
</header>
<section id = "main">
<u1 id = "todo-list">
<li>
<div class="view">
<input type="checkbox" class="toggle">
<label>Etendre le linge</label>
<button class="destroy"></button>
</div>
</li>
</u1>
</section>
</section>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/
libs/angularjs/1.0.3/angular.min.js"></script>
</body>
</html>
You have position:absolute on your checkbox. Removing it fixes the issue.
#todo-list input[type='checkbox'] {
text-align: center;
width: 40px;
height: auto;
/* position: absolute; */
/* top: 0; */
/* bottom: 0; */
margin: auto 0;
-webkit-appearance: none;
-ms-appearance: none;
-o-appearance: none;
appearance: none;
}
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