CSS:
#content-items .thumb-artist img {
width: 220px;
position: relative;
z-index: 10;
height: 147px;
}
#filter-artist {
font-family: Arial, Helvetica, sans-serif;
font-size: 10px;
padding: 25px 0 25px 10px;
position: relative;
font-weight: bold;
color: #666666;
text-transform: uppercase;
float: left;
width: 100%;
line-height: 1.4em;
}
#filter-artist #s {
border: 0;
font-size: 10px;
color: #666666;
background: transparent;
text-transform: uppercase;
font-family: Arial, Helvetica, sans-serif;
padding: 1px 0px;
width: 80%;
}
#content-items {
width: 960px;
margin: 0 auto;
color: #fff;
}
#filter-artist span {
float: left;
}
#filter-artist a {
color: #666666;
padding: 0 8px;
float: left;
}
.active-filter {
color: #fff!important;
}
#filter-artist #submit {
background-image: url(img/icons.png);
background-position: -84px 0px;
background-color: transparent;
border: 0;
height: 14px;
line-height: 0;
padding: 0;
width: 14px;
float:right;
}
#filter-artist > p {display:none;}
#filter-artist form {
float: left;
border-bottom: 1px solid #666666;
}
#filter-artist #submit:hover {
background-image: url(img/icons.png);
background-position: -84px -14px;
}
#content-items .artist {
width: 25%;
float: left;
padding: 0 1% 40px 1%;
line-height: 1em;
height: 270px;
height: 190px!important;
}
#content-items .thumb-artist {
position: relative;
}
.thumb-artist img:hover .social-content {
opacity:1;
}
#content-items .artist h3 {
font-size: 18px;
margin: 10px 0;
line-height: 1em;
color: #fff;
font-family: "futura-pt",sans-serif;
}
}
element.style {
display: none;
}
#load-items .social-content {
position: absolute;
top: 80%;
left: 0%;
z-index: 15;
width: 100%;
text-align: center;
opacity:0;
-webkit-transition: all 0.5s ease-in;
-moz-transition: all 0.5s ease-in;
-o-transition: all 0.5s ease-in;
transition: all 0.5s ease-out;
}
.social {
-webkit-border-radius: 3px;
-moz-border-radius: 3px;
border-radius: 3px;
line-height: 1em;
display: inline-block;
font-size: 10px;
font-family: Arial, Helvetica, sans-serif;
color: #fff;
line-height: 11px;
margin-right: 4px;
}
.facebook {
position:relative;
background-image: url(img/icons.png);
background-position: -3px -1px;
width: 20px;
height: 20px;
padding: 5px;
z-index:15;
float:left;
}
.web {
font-weight: bold;
font-family: Arial, Helvetica, sans-serif;
float:left;
}
.sat-color {
background-color: #ff0033;
padding: 5px;
}
.social-content a:hover {
color: #ff3333;
}
.twitter {
position:relative;
background-image: url(img/icons.png);
background-position: -45px -1px;
width: 20px;
height: 20px;
padding: 5px;
float:left;
}
#load-items .social-content:hover {
position: absolute;
top: 80%;
left: 0%;
z-index: 15;
width: 100%;
text-align: center;
opacity:1;
}
.sat-color:hover {
background-color: #ff3333;
color: #fff !important;
}
HTML:
<article id="content-items">
<div id="filter-artist">
<span>FILTER:</span>
ALLNEWESTALPHABETICAL</div>
<div id="load-items">
<div class="artist">
<div class="thumb-artist">
<img width="300" height="138" src="http://downunderlabelgroup.com/wp-content/uploads/2013/03/k_oconnor_lge-300x138.jpg" class="attachment-medium wp-post-image" alt="Kim O'Connor">
<span class="social-content">
OFFICIAL SITE
</span>
</div>
<h3 class="name-artist">Troye Sivan</h3>
</div></div></article>
At the moment the hover effect is only applied when the mouse is hovered onto the social content. I would like to apply it to the whole picture.
So if anyone hovers onto the image the social content is displayed.
Thanks alot.
There are 2 options, 1 make the hover on the div, 2 hover on the img
1st option (recommended):
#content-items .thumb-artist:hover .social-content {
opacity: 1;
}
2nd option (use + next selector):
#content-items .thumb-artist .wp-post-image:hover + .social-content {
opacity: 1;
}
DEMO: http://jsfiddle.net/7w8spct6/
Maybe a CSS rule like this could work
img.attachement-medium:hover + .social-content {
position: absolute;
top: 80%;
left: 0%;
z-index: 15;
width: 100%;
text-align: center;
opacity:1;
}
But a better way would be to actually take the <img> and <span> elements you want and put them inside a new <div> and then have a rule for the contents of the <div>
<div class="wrapper">
<img width="300" height="138" src="http://downunderlabelgroup.com/wp-content/uploads/2013/03/k_oconnor_lge-300x138.jpg" class="content attachment-medium wp-post-image" alt="Kim O'Connor">
<span class="social-content content">
OFFICIAL SITE
</span>
</div>
.wrapper:hover .content {
/*styles*/ }
Related
Hello I choose a template to work with, it was fine at the beginning but after some modification, I cannot see where I messed it up, the whole page is moved to the left but I don't know where is the problem.
The HTML code 👇
<!DOCTYPE html>
<html lang="en">
<head>
......stuff
</head>
<body data-spy="scroll" data-target=".navbar" data-offset="51">
<!-- Nav Bar Start -->
<div class="navbar navbar-expand-lg bg-light navbar-light">
<div class="container-fluid">
<img src="img/mylogo2.png" width="80px">
<div class="collapse navbar-collapse justify-content-between" id="navbarCollapse">
<div class="navbar-nav ml-auto">
.... nav stuff
</div>
</div>
</div>
</div>
<!-- Nav Bar End -->
<!-- Hero Start -->
<div class="hero" id="home">
<div class="container-fluid">
<div class="row align-items-center">
<div class="col-sm-12 col-md-6 mt-4">
<div class="hero-content">
<div class="hero-text">
<p>Welcome To </p>
<h1>{{ strtoupper($heros->title) }}</h1>
<h2></h2>
<div class="typed-text">
<p style="color:#ED428B;"> {{ $heros->content }}</p>
</div>
</div>
<div class="hero-btn mt-4">
<a class="btn" href="">Hire Us</a>
<a class="btn" href="#contact">Contact Us</a>
</div>
</div>
</div>
<div class="col-sm-12 col-md-6 d-none d-md-block">
<div class="hero-image">
<img src="images/{{$heros->img}}" alt="Hero Image" width="600px" height="600px">
</div>
</div>
</div>
</div>
</div>
<!-- Hero End -->
<!-- Service Start -->
<div class="service" id="service">
<div class="container">
...
</div>
</div>
<!-- Service End -->
<!-- Banner Start -->
<div class="banner wow zoomIn" data-wow-delay="0.1s">
<div class="container">
.....
</div>
</div>
<!-- Banner End -->
<!-- Portfolio Start -->
<p>..............................</p>
<!-- Portfolio End -->
<!-- Banner Start -->
<div class="banner wow zoomIn" data-wow-delay="0.1s">
<div class="container">
....banner
</div>
</div>
<!-- Banner End -->
<!-- Price Start -->
<div class="price" id="price">
.....
</div>
<!-- Price End -->
<!-- Testimonial Start -->
<div class="testimonial wow fadeInUp" data-wow-delay="0.1s" id="review">
<div class="text-center wow zoomIn" data-wow-delay="0.1s">
.....test...stuff
</div>
</div>
<!-- Testimonial End -->
<!-- Footer Start -->
<div class="footer shape wow fadeIn" data-wow-delay="0.3s">
<div class="container-fluid">
......footer stuff
</div>
</div>
<!-- Footer End -->
<!-- Back to top button -->
<i class="fa fa-chevron-up"></i>
<!-- Pre Loader -->
<div id="loader" class="show">
<div class="loader"></div>
</div>
<!-- JavaScript Libraries -->
<script src="https://code.jquery.com/jquery-3.4.1.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.bundle.min.js"></script>
<script>//....some script</script>
</body>
<style>
.brands {
width: 100%;
padding-top: 90px;
padding-bottom: 90px
}
.brands_slider_container {
height: 130px;
border: solid 1px #e8e8e8;
box-shadow: 0px 1px 5px rgba(0, 0, 0, 0.1);
padding-left: 97px;
padding-right: 97px;
background: #fff
}
.brands_slider {
height: 100%;
}
.brands_item {
height: 150px;
width: 100px;
}
.brands_item img {
width: 50px;
height: 85px;
}
.brands_nav {
position: absolute;
top: 50%;
-webkit-transform: translateY(-50%);
-moz-transform: translateY(-50%);
-ms-transform: translateY(-50%);
-o-transform: translateY(-50%);
transform: translateY(-50%);
padding: 5px;
cursor: pointer
}
.brands_nav i {
color: #e5e5e5;
-webkit-transition: all 200ms ease;
-moz-transition: all 200ms ease;
-ms-transition: all 200ms ease;
-o-transition: all 200ms ease;
transition: all 200ms ease
}
.brands_nav:hover i {
color: #676767
}
.brands_prev {
left: 40px;
}
.brands_next {
right: 40px
}
</style>
</html>
and the css👇
excuse me if it a lot of code but I want to host this app as soon as possible cuz I already paid for the hosting.
body {
color: #797979;
background: #ffffff;
font-family: 'Montserrat', sans-serif;
overflow-x: hidden;
}
h1,
h2,
h3,
h4,
h5,
h6 {
color: #414141;
}
a {
color: #313131;
transition: .3s;
}
a:hover,
a:active,
a:focus {
color: #009FF9;
outline: none;
text-decoration: none;
}
.btn:focus,
.form-control:focus {
box-shadow: none;
}
.container-fluid {
max-width: 1366px;
}
.btn {
padding: 12px 25px;
font-size: 14px;
font-weight: 600;
letter-spacing: 1px;
color: #ffffff;
background: #009FF9;
border: 2px solid transparent;
border-radius: 0;
box-shadow: inset 0 0 0 50px #009FF9;
transition: ease-out 0.3s;
-webkit-transition: ease-out 0.3s;
-moz-transition: ease-out 0.3s;
}
.btn:hover {
color: #009FF9;
background: transparent;
box-shadow: inset 0 0 0 0 #009FF9;
border-color: #009FF9;
}
#loader {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
display: flex;
align-items: center;
justify-content: center;
background: #ffffff;
opacity: 0;
visibility: hidden;
-webkit-transition: opacity .3s ease-out, visibility 0s linear .3s;
-o-transition: opacity .3s ease-out, visibility 0s linear .3s;
transition: opacity .3s ease-out, visibility 0s linear .3s;
z-index: 999;
}
#loader.show {
-webkit-transition: opacity .6s ease-out, visibility 0s linear 0s;
-o-transition: opacity .6s ease-out, visibility 0s linear 0s;
transition: opacity .6s ease-out, visibility 0s linear 0s;
visibility: visible;
opacity: 1;
}
#loader .loader {
position: relative;
width: 45px;
height: 45px;
border: 5px solid #dddddd;
border-top: 5px solid #009FF9;
border-radius: 50%;
-webkit-animation: spin 2s linear infinite;
animation: spin 2s linear infinite;
}
#-webkit-keyframes spin {
0% { -webkit-transform: rotate(0deg); }
100% { -webkit-transform: rotate(360deg); }
}
#keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
.back-to-top {
position: fixed;
display: none;
width: 44px;
height: 44px;
padding: 8px 0;
text-align: center;
line-height: 1;
font-size: 22px;
right: 15px;
bottom: 15px;
z-index: 9;
border-radius: .3em;
}
.back-to-top i {
color: #ffffff;
}
.back-to-top:hover i {
color: #414141;
}
/*********** Nav Bar CSS **********/
.navbar {
position: relative;
transition: .5s;
z-index: 999;
}
.navbar.nav-sticky {
position: fixed;
top: 0;
width: 100%;
box-shadow: 0 2px 5px rgba(0, 0, 0, .3);
}
.navbar .navbar-brand {
margin: 0;
font-size: 45px;
line-height: 0px;
font-weight: 700;
letter-spacing: 2px;
transition: .5s;
}
.navbar .navbar-brand img {
max-width: 100%;
max-height: 40px;
}
.navbar .dropdown-menu {
margin-top: 0;
border: 0;
border-radius: 0;
background: #f8f9fa;
}
/********** Hero CSS ***********/
.hero {
position: relative;
width: 100%;
margin-bottom: 45px;
padding: 120px 0 0 0;
overflow: hidden;
background: linear-gradient(#009FF9, #ffffff), url(../img/hero-bg.jpg);
background-position: center;
background-repeat: no-repeat;
background-size: cover;
}
.hero .container-fluid {
padding: 0;
}
.hero .hero-image {
position: relative;
/* text-align: right; */
/* padding-right: 75px; */
padding-right: 4em;
}
.hero .hero-image img {
}
.hero .hero-content {
margin-top: -12em;
position: relative;
padding-left: 75px;
display: flex;
align-items: flex-start;
justify-content: center;
flex-direction: column;
}
.hero .hero-text p {
color: #ffffff;
font-size: 25px;
font-weight: 600;
margin-bottom: 15px;
}
.hero .hero-text h1 {
color: #ffffff;
font-size: 60px;
font-weight: 700;
letter-spacing: 3px;
margin-bottom: 15px;
}
.hero .hero-text h2 {
display: inline-block;
margin: 0;
height: 35px;
color: #ffffff;
font-size: 35px;
font-weight: 600;
}
.hero .hero-text .typed-text {
display: none;
}
.hero .hero-text .typed-cursor {
font-size: 35px;
font-weight: 300;
color: #ffffff;
}
.hero .hero-btn .btn {
margin-top: 35px;
color: #009FF9;
background: #ffffff;
box-shadow: inset 0 0 0 50px #ffffff;
border-radius: .3em;
}
.hero .hero-btn .btn:hover {
color: #ffffff;
background: transparent;
box-shadow: inset 0 0 0 0 #ffffff;
border-color: #ffffff;
}
.hero .hero-btn .btn:first-child {
margin-right: 10px;
}
/******* Section Header ********/
.section-header {
position: relative;
margin-bottom: 45px;
}
.section-header p {
display: inline-block;
margin: 0 30px;
margin-bottom: 10px;
padding-left: 15px;
position: relative;
font-size: 16px;
font-weight: 600;
letter-spacing: 1px;
text-transform: uppercase;
background: #ffffff;
}
.section-header p::before {
position: absolute;
content: "";
height: 3px;
top: 11px;
right: 0;
left: -30px;
background: #009FF9;
z-index: -1;
}
.section-header p::after {
position: absolute;
content: "";
width: 3px;
height: 3px;
top: 11px;
left: 3px;
background: #009FF9;
z-index: 1;
}
.section-header h2 {
margin: 0;
position: relative;
font-size: 45px;
font-weight: 700;
}
/********** About CSS **********/
.about {
position: relative;
width: 100%;
margin: -45px 0 45px 0;
}
.about .col-lg-6 {
padding: 0;
}
.about .section-header {
margin-bottom: 30px;
}
.about .about-img {
position: relative;
height: 100%;
}
.about .about-img img {
position: relative;
width: 100%;
height: 100%;
object-fit: cover;
}
.about .about-content {
padding: 0 60px;
}
.about .about-text p {
font-size: 16px;
}
.about .skills {
margin-bottom: 30px;
}
.about .skill-name {
margin-top: 15px;
}
.about .skill-name p {
display: inline-block;
margin-bottom: 5px;
font-size: 16px;
font-weight: 400;
}
.about .skill-name p:last-child {
float: right;
}
.about .progress {
height: 10px;
border-radius: 10px;
background: #dddddd;
}
.about .progress .progress-bar {
width: 0px;
background: #009FF9;
border-radius: 10px;
transition: 2s;
}
.about .about-text a.btn {
margin-top: 15px;
}
/******* Experience CSS ********/
.experience {
position: relative;
padding: 45px 0 15px 0;
}
.experience .timeline {
position: relative;
width: 100%;
}
.experience .timeline::after {
content: '';
position: absolute;
width: 2px;
background: #009FF9;
top: 0;
bottom: 0;
left: 50%;
margin-left: -1px;
}
.experience .timeline .timeline-item {
position: relative;
background: inherit;
width: 50%;
margin-bottom: 30px;
}
.experience .timeline .timeline-item.left {
left: 0;
padding-right: 30px;
}
.experience .timeline .timeline-item.right {
left: 50%;
padding-left: 30px;
}
.experience .timeline .timeline-item::after {
content: '';
position: absolute;
width: 16px;
height: 16px;
top: 48px;
right: -8px;
background: #ffffff;
border: 2px solid #009FF9;
border-radius: 16px;
z-index: 1;
}
.experience .timeline .timeline-item.right::after {
left: -8px;
}
.experience .timeline .timeline-item::before {
content: '';
position: absolute;
width: 0;
height: 0;
top: 46px;
right: 10px;
z-index: 1;
border: 10px solid;
border-color: transparent transparent transparent #dddddd;
}
.experience .timeline .timeline-item.right::before {
left: 10px;
border-color: transparent #dddddd transparent transparent;
}
.experience .timeline .timeline-date {
position: absolute;
width: 100%;
top: 44px;
font-size: 16px;
font-weight: 600;
color: #009FF9;
text-transform: uppercase;
letter-spacing: 1px;
z-index: 1;
}
.experience .timeline .timeline-item.left .timeline-date {
text-align: left;
left: calc(100% + 55px);
}
.experience .timeline .timeline-item.right .timeline-date {
text-align: right;
right: calc(100% + 55px);
}
.experience .timeline .timeline-text {
padding: 30px;
background: #ffffff;
position: relative;
border-right: 5px solid #dddddd;
box-shadow: 0 0 60px rgba(0, 0, 0, .08);
}
.experience .timeline .timeline-item.right .timeline-text {
border-right: none;
border-left: 5px solid #dddddd;
}
.experience .timeline .timeline-text h2 {
margin: 0 0 5px 0;
font-size: 22px;
font-weight: 600;
}
.experience .timeline .timeline-text h4 {
margin: 0 0 10px 0;
font-size: 16px;
font-style: italic;
font-weight: 400;
}
.experience .timeline .timeline-text p {
margin: 0;
font-size: 16px;
}
/********* Service CSS *********/
.service {
position: relative;
width: 100%;
padding: 45px 0 15px 0;
}
.service .service-item {
position: relative;
margin-bottom: 30px;
display: flex;
align-items: center;
box-shadow: inset 0 0 0 0 transparent;
transition: ease-out 0.5s;
}
.service .service-item:hover {
box-shadow: inset 800px 0 0 0 #009FF9;
}
.service .service-icon {
position: relative;
width: 150px;
min-height: 150px;
display: flex;
align-items: center;
justify-content: center;
border: 1px solid #009FF9;
background: #ffffff;
}
.service .service-icon i {
position: relative;
font-size: 60px;
color: #009FF9;
transition: .3s;
}
.service .service-item:hover i {
font-size: 75px;
}
.service .service-text {
position: relative;
width: calc(100% - 120px);
padding: 0 30px;
}
.service .service-text h3 {
margin-bottom: 10px;
font-size: 20px;
font-weight: 600;
transition: 1s;
}
.service .service-text p {
margin: 0;
font-size: 16px;
transition: 1s;
}
/******** Portfolio CSS ********/
.portfolio {
position: relative;
padding: 45px 0 15px 0;
}
.portfolio #portfolio-filter {
padding: 0;
margin: -15px 0 25px 0;
list-style: none;
font-size: 0;
text-align: center;
}
.portfolio #portfolio-filter li {
cursor: pointer;
display: inline-block;
margin: 5px;
padding: 6px 12px;
font-size: 14px;
font-weight: 600;
color: #ffffff;
background: #009FF9;
border: 2px solid transparent;
border-radius: 0;
box-shadow: inset 0 0 0 50px #009FF9;
transition: ease-out 0.3s;
-webkit-transition: ease-out 0.3s;
-moz-transition: ease-out 0.3s;
}
.portfolio #portfolio-filter li:hover,
.portfolio #portfolio-filter li.filter-active {
color: #009FF9;
background: transparent;
box-shadow: inset 0 0 0 0 #009FF9;
border-color: #009FF9;
}
.portfolio .portfolio-item {
position: relative;
}
.portfolio .portfolio-wrap {
position: relative;
width: 100%;
}
.portfolio .portfolio-img {
position: relative;
overflow: hidden;
}
.portfolio .portfolio-img img {
position: relative;
width: 100%;
height: 100%;
object-fit: cover;
transform: scale(1.1);
transition: .5s;
}
.portfolio .portfolio-item:hover img {
margin-left: 15px;
}
.portfolio .portfolio-text {
position: relative;
height: 60px;
width: calc(100% - 30px);
margin: -30px 15px 30px 15px;
display: flex;
align-items: center;
background: #ffffff;
box-shadow: 0 0 15px rgba(0, 0, 0, .12);
}
.portfolio .portfolio-text h3 {
width: calc(100% - 70px);
font-size: 18px;
font-weight: 600;
margin: 0 0 0 15px;
white-space: nowrap;
overflow: hidden;
}
.portfolio .portfolio-text a.btn {
width: 50px;
height: 50px;
padding: 0 0 2px 1px;
display: flex;
align-items: center;
justify-content: center;
font-size: 45px;
font-weight: 100;
border-radius: .1em;
}
.portfolio .portfolio-item:hover a.btn {
color: #009FF9;
background: transparent;
box-shadow: inset 0 0 0 0 #009FF9;
border-color: #009FF9;
}
/********* Banner CSS **********/
.banner {
position: relative;
width: 100%;
margin: 45px 0;
padding: 90px 0;
background: #009FF9;
}
.banner .container {
max-width: 750px;
text-align: center;
}
.banner .section-header {
margin-bottom: 20px;
}
.banner .section-header p {
color: #414141;
background: transparent;
}
.banner .section-header p::after {
display: none;
}
.banner .section-header h2 {
color: #ffffff;
}
.banner .section-header h2 span {
color: #414141;
font-size: 50px;
}
.banner .banner-text p {
font-size: 18px;
color: #ffffff;
}
.banner .banner-text .btn {
margin-top: 15px;
color: #009FF9;
background: #ffffff;
box-shadow: inset 0 0 0 50px #ffffff;
border-radius: .3em;
}
/********* Pricing CSS *********/
.price {
position: relative;
width: 100%;
padding: 45px 0 15px 0;
}
.price .row {
padding: 0 15px;
}
.price .col-md-4 {
padding: 0;
}
.price .price-item {
position: relative;
margin-bottom: 30px;
background: #ffffff;
}
.price .featured-item {
box-shadow: 0 0 30px rgba(0, 0, 0, .2);
z-index: 1;
border-radius: .3em;
}
.price .price-header,
.price .price-body,
.price .price-footer {
position: relative;
text-align: center;
}
.price .price-header {
padding: 45px 0 30px 0;
color: #414141;
}
.price .price-item.featured-item .price-header {
color: #009FF9;
}
.price .price-title h2 {
font-size: 25px;
font-weight: 400;
text-transform: uppercase;
}
.price .price-prices h2 {
font-size: 45px;
font-weight: 700;
margin-left: 10px;
}
.price .price-prices h2 small {
position: absolute;
font-size: 18px;
font-weight: 400;
margin-top: 9px;
margin-left: -12px;
}
.price .price-prices h2 span {
margin-left: 1px;
font-size: 18px;
font-weight: 400;
}
.price .price-item.featured-item h2 {
color: #009FF9;
}
.price .price-body {
padding: 0 0 20px 0;
}
.price .price-description ul {
margin: 0;
padding: 0;
list-style: none;
}
.price .price-description ul li {
padding: 0 0 20px 0;
}
.price .price-item .price-action {
padding-bottom: 45px;
}
.price .price-item .price-action .btn {
color: #ffffff;
background: #414141;
box-shadow: inset 0 0 0 50px #414141;
border-radius: .3em;
}
.price .price-item .price-action .btn:hover {
color: #414141;
background: transparent;
box-shadow: inset 0 0 0 0 #414141;
border-color: #414141;
}
.price .price-item.featured-item .price-action .btn {
color: #ffffff;
background: #009FF9;
box-shadow: inset 0 0 0 50px #009FF9;
border-radius: .3em;
}
/*********** Team CSS **********/
.team {
position: relative;
width: 100%;
padding: 45px 0 15px 0;
}
.team .team-item {
position: relative;
background: #ffffff;
margin-bottom: 30px;
display: flex;
align-items: center;
justify-content: flex-start;
box-shadow: inset 0 0 0 0 transparent;
transition: ease-out 0.5s;
border-radius: .3em;
}
.team .team-img {
position: relative;
width: 50%;
overflow: hidden;
border-radius: .3em;
}
.team .team-img img {
position: relative;
width: 100%;
transition: .5s;
}
.team .team-text {
position: relative;
width: 50%;
padding: 0 30px;
}
.team .team-text h2 {
color: #009FF9;
font-size: 18px;
font-weight: 600;
margin-bottom: 5px;
transition: 1s;
}
.team .team-text h4 {
font-size: 14px;
font-weight: 600;
margin-bottom: 15px;
transition: 1s;
}
.team .team-text p {
margin-bottom: 20px;
transition: 1s;
}
.team .team-social {
position: relative;
display: flex;
align-items: center;
justify-content: flex-start;
}
.team .team-social a.btn {
width: 35px;
height: 35px;
padding: 0;
display: flex;
align-items: center;
justify-content: center;
font-size: 14px;
font-weight: normal;
margin-right: 5px;
border-radius: .2em;
}
.team .team-item:hover {
box-shadow: inset 800px 0 0 0 #009FF9;
}
.team .team-item:hover .team-img img {
transform: scale(1.2);
}
.team .team-item:hover .team-text h2,
.team .team-item:hover .team-text h4,
.team .team-item:hover .team-text p {
color: #ffffff;
}
.team .team-item:hover .team-social a.btn {
background: #ffffff;
}
.team .team-item:hover .team-social a.btn:hover {
border-color: #ffffff;
}
/******* Testimonial CSS *******/
.testimonial {
position: relative;
margin: 45px 0;
padding: 90px 0;
background: #009FF9;
}
.testimonial .container {
max-width: 900px;
}
.testimonial .testimonial-icon {
margin-bottom: 45px;
text-align: center;
}
.testimonial .testimonial-icon i {
font-size: 60px;
color: rgba(256, 256, 256, .5);
}
.testimonial .testimonial-item {
position: relative;
margin: 0 15px;
text-align: center;
}
.testimonial .testimonial-img {
position: relative;
margin-bottom: 15px;
z-index: 1;
}
.testimonial .testimonial-item img {
margin: 0 auto;
width: 120px;
padding: 10px;
/* border: 5px dotted #ffffff; */
/* border-radius: 100px; */
}
/********* Contact CSS *********/
.contact {
position: relative;
width: 100%;
margin: 45px 0;
background: #ffffff;
}
.contact .container-fluid {
background: url(../img/mail.png) left center no-repeat;
background-size: contain;
}
.contact .contact-form {
position: relative;
padding: 90px 0 90px 45px;
background: #ffffff;
}
.contact .contact-form input {
color: #8d8d8d;
padding: 15px 0;
background: none;
border-radius: 0;
border: none;
border-bottom: 1px solid #8d8d8d;
}
.contact .contact-form textarea {
color: #5a5151;
height: 90px;
padding: 15px 0;
background: none;
border-radius: 0;
border: none;
border-bottom: 1px solid #8d8d8d;
}
.contact .contact-form .form-control::placeholder {
color: #747474;
opacity: 1;
}
.contact .contact-form .form-control:-ms-input-placeholder,
.contact .contact-form .form-control::-ms-input-placeholder {
color: #8d8d8d;
}
/*********** Blog CSS **********/
.blog {
position: relative;
width: 100%;
padding: 45px 0 15px 0;
}
.blog .blog-item {
position: relative;
margin-bottom: 30px;
}
.blog .blog-img {
position: relative;
width: 100%;
overflow: hidden;
}
.blog .blog-img img {
width: 100%;
transition: .5s;
}
.blog .blog-item:hover img {
transform: scale(1.1);
}
.blog .blog-text {
position: relative;
padding: 30px;
border-right: 1px solid rgba(0, 0, 0, .07);
border-bottom: 1px solid rgba(0, 0, 0, .07);
border-left: 1px solid rgba(0, 0, 0, .07);
}
.blog .blog-text h2 {
font-size: 25px;
font-weight: 600;
}
.blog .blog-text p {
margin-bottom: 10px;
}
.blog .blog-item a.btn {
margin-top: 10px;
padding: 8px 15px;
}
.blog .blog-item a.btn i {
margin-left: 5px;
}
.blog .blog-meta {
position: relative;
display: flex;
margin-bottom: 15px;
}
.blog .blog-meta p {
margin: 0 10px 0 0;
font-size: 13px;
}
.blog .blog-meta i {
color: #414141;
margin-right: 5px;
}
.blog .blog-meta p:last-child {
margin: 0;
}
/********* Footer CSS **********/
.footer {
position: relative;
margin-top: 45px;
/* background: #009FF9; */
}
.footer .container-fluid {
padding: 60px 0 0 0;
}
.footer .footer-info {
position: relative;
width: 100%;
text-align: center;
}
.footer .footer-info h2 {
margin-bottom: 20px;
font-size: 30px;
font-weight: 700;
color: #ffffff;
}
.footer .footer-info h3 {
margin-bottom: 25px;
font-size: 22px;
font-weight: 600;
color: #ffffff;
}
.footer .footer-menu {
width: 100%;
display: flex;
justify-content: center;
}
.footer .footer-menu p {
color: #ffffff;
font-size: 22px;
font-weight: 600;
line-height: 20px;
padding: 0 15px;
border-right: 1px solid #ffffff;
}
.footer .footer-menu p:last-child {
border: none;
}
.footer .footer-social {
position: relative;
margin-top: 15px;
}
.footer .footer-social a {
display: inline-block;
}
.footer .footer-social a i {
margin-right: 15px;
font-size: 20px;
color: #ffffff;
transition: .3s;
}
.footer .footer-social a:last-child i {
margin: 0;
}
.footer .footer-social a:hover i {
color: #414141;
}
.footer .copyright {
position: relative;
text-align: center;
margin-top: 30px;
padding-top: 25px;
padding-bottom: 25px;
}
.footer .copyright::before {
position: absolute;
content: "";
width: 50%;
height: 1px;
top: 0;
left: 25%;
background: rgba(256, 256, 256, .2);
}
enter image description here
Thanks to all, I just knew where the problem was i added this to the body
max-width: 100%;
overflow-x: hidden;
and it's solved the problem credit to this user
omma2289
I can't get an element to go where I want it to. I am only having this problem because of the way I did my header. I applied position: absolute. You can see an example here: http://jacobgasser.com and you can find all the code on there, or you can read down a little farther and I put it there.
I want the text in the top left of the page to be on the white part of the page
Here is the index.html
<body onload="loadUp();">
<div class="menu">
<a href="https://github.com/jacobgasser" target="_blank"><div
class="menuItem">Projects</div></a>
</div>
<div class="titleBG">
<h1 class="title" onmouseover="coolThing();"onmouseout="notCoolThing();">Jacob Gasser</h1>
</div>
<div class="article">
<div class="articleHead">Who am I?</div>
</div>
<script src="scripts/main.js"></script>
</body>
Here is main.css
body {
margin:0;
padding:0;
}
.title {
color: white;
text-align: center;
font-size: 1000%;
opacity: 0;
-webkit-transition: 0.2s;
}
a {
text-decoration: none;
color: inherit;
}
.article {
font-family: "Arial";
display: inline-block;
padding: 5px 10px 5px 10px;
margin: 5px 10px 5px 10px;
text-align: center;
position: relative;
}
.articleHead {
display: inline-block;
padding: 5px 10px 5px 10px;
margin: 5px 10px 5px 10px;
}
.menu {
display: block;
color: white;
float: right;
margin-right: 10px;
margin-top: 5px;
opacity: 0;
}
.menuItem {
font-size: 400%;
display: block;
padding-left: 20px;
padding-right: 20px;
-webkit-transition: 0.2s;
border-radius: 5px;
}
.menuItem:hover {
background-color: white;
color: black;
cursor: pointer;
-webkit-transition: 0.2s;
}
.titleBG {
background-color: #23272A;
display: block;
width: 100%;
z-index: -1;
position: fixed;
top: 0;
}
::selection {
color: #23272A;
background-color: white;
}
::-moz-selection {
color: #23272A;
background-color: white;
}
#font-face {
font-family: lemon;
src: url("fonts/LemonMilk.otf");
}
#font-face {
font-family: cavs;
src: url("fonts/CaviarDreams.ttf");
}
A simple solution to this issue is to remove the position: fixed; top: 0; and adjust the margin-top and margin-bottom of the page. Just change the CSS for .titleBG and .title to be the following:
.titleBG {
background-color: #23272A;
display: block;
width: 100%;
z-index: -1;
}
.title {
color: white;
text-align: center;
font-size: 1000%;
opacity: 0;
-webkit-transition: 0.2s;
margin: 0 /* You can add a margin-left or margin-right if you want, or even margin-bottom, just keep the margin-top at 0*/;
}
This will give you the following result:
I'm fairly new to html, and when I tried to create a webpage, I encountered a problem. I managed to make a navigation bar with a drop down menu directly under the "Games" section, but if I scroll down and open the drop down menu, it no longer opens directly under the navigation bar. This is my HTML code.
<div class="wrapper">
<div id="main-title">
<header>
<h1>Max Reviews</h1>
</header>
</div> <!-- Title box-->
<div id="nav"> <!-- Navigation Bar -->
<nav>
<ul>
<li><a class="active" href="#">Home</a></li>
<li>About Me</li> <!-- Link to about page -->
<li class="drop">
<p>Games</p>
<div class="drop-content">
<p>Red Faction: Guerrilla</p> <!-- Contains links to the respective pages -->
<p>Way of the Samurai 3</p>
<p>Singularity</p>
</div>
</li>
<li>Reviews</li>
<li>External Store</li> <!-- Link to external site -->
<li>Videos</li> <!-- Contains links to Youtube -->
</ul>
</nav>
</div>
<div class="image"> <!-- Banner-->
<a href="singularity.html">
<img src="modified singularity aging 1.jpg" alt="singularity">
<h2><span>Recommended Game of the Month</span></h2>
</a>
</div>
<div id="home-content"><p>Learn more about the site ☛here☚</p></div>
<div id="footer">
<p>© Copyright 2016-2017. All images here were taken and edited by me. All rights reserved. Games featured here might not be suitable for all audience.</p>
</div>
</div>
And this is the stylesheet.
article, body, div, footer, header, h1, h2, p {
border: 0;
padding: 0;
margin: 0;
}
html, body {
height: 100%;
margin: 0;
width: 100%;
background-color: #FFFFFF;
padding: 0px;
overflow-x: hidden;
}
body {
transition: background 600s ease-in-out;
}
body:hover {
background-color: #4B0101;
}
/*main title*/
#main-title {
background-color: #33B2E7;
color: #FFFFFF;
position: relative;
top: 25px;
left: 20px;
padding: 10px;
margin-left: 10px;
display: inline-block;
transition: color 1s, transform 1s;
transition-delay: 2s;
}
#main-title:hover {
color: black;
transform: rotate(360deg);
}
/* Nav */
#nav nav{
padding-top: 100px;
margin-bottom: 0;
}
#nav ul {
list-style-type: none;
margin: 0;
overflow: hidden;
background-color: #1C86EE;
padding: 0;
position: relative;
width: 100%;
bottom: 40px;
display: inline-block;
}
#nav li {
float: left;
width: 16%;
}
li a, .dropbtn {
display: inline-block;
color: #FFFFFF;
text-align: center;
padding-left: 50px;
padding-right: 50px;
text-decoration: none;
}
.active {
background-color: #6CCC0A;
padding-right: 50px;
}
li a:hover, .drop:hover .dropbtn {
background-color: #BFA811;
}
a {
padding-top: 10px;
padding-bottom: 10px;
}
li.drop {
display: inline-block;
}
.drop-content {
display: none;
position: absolute;
background-color: #970707;
min-width: 50px;
box-shadow: 0px 8px 16px 0px #000000;
z-index: 100;
}
.drop-content a {
color: #FFFFFF;
padding: 15px 20px;
display: block;
text-align: left;
}
.drop-content a:hover {
background-color: #02BBC4
}
.drop:hover .drop-content {
display: block;
position: fixed;
top: 155px;
border: 1px solid black;;
}
/*banner*/
.image {
position: relative;
width: 100%;
}
.image h2 {
position: absolute;
top: 600px;
text-align: center;
width: 100%;
right: 350px;
}
.image h2 span {
color: #FFFFFF;
font: Arial, Calibri, Sans-serif;
background: #000000;
padding: 10px;
}
.image h2:hover span {
background-color: #003316;
}
.button {
position: absolute;
top: 1013px;
left: 700px;
padding: 16px 32px;
text-align: center;
margin: 4px 2px;
display: inline-block;
cursor: pointer;
background-color: rgb(41,120,104);
color: rgb(240,144,22);
font-family: Cambria, Times New Roman, serif;
font-size: 20px;
}
/*content*/
#home-content {
position: relative;
padding: 20px;
text-align: center;
margin-left: 90px;
display: block;
color: #8A0707
}
#home-content a {
color: #09922A
}home-content a:visited {
color: #000000
}
/*Footer*/
#footer {
background: #000000;
width: 100%;
height: 40px;
position: relative;
bottom: 0;
left: 0;
padding-top: 10px;
overflow: hidden;
}
#footer p {
font-family: arial, calibri, sans-serif;
color: #FFFFFF;
text-align: center;
}
#aboutme h2 {
margin-bottom: 20px;
text-align: center;
text-decoration: underline;
font-family: Cambria, Calibri, sans-serif;
font-size: 20px;
color: #000000;
}
#aboutme article {
padding-top: 20px;
position: relative;
margin-left: 25%;
margin-right: 25%;
display: inline-block;
font-family: arial, cambria, serif;
line-height: 200%;
color: #777000;
text-align: center;
border: 2px solid #000000;
padding: 10px;
}
#gallery-title {
text-align: center;
font-family: Cambria, calibri, sans-serif;
padding-top: 20px;
}
#image-1 {
text-align: center;
margin: 0 25%;
padding: 20px;
}
.img-desc-1 {
padding: 20px;
color: #047615;
}
#image-2 {
text-align: center;
margin: 0 25%;
border: 2px solid #262020;
padding: 20px;
}
#prompt-text {
text-align: center;
padding-top: 30px;
font-family: cambria, calibri, sans-serif;
}
.image-container img{
height: 300px;
width: 300px;
padding-left: 60px;
padding-top: 60px;
}
.image-container p{
padding-left: 80px;
font-family: Arial, cambria, sans-serif;
color: #560404;
text-decoration: none;
}
.image-container {
display: block;
text-align: center;
padding-left: 20px;
}
#image1 {
padding-right: 60px;
padding-bottom: 10%
}
#image2 {
padding-right: 60px;
padding-bottom: 10%;
}
#image3 {
padding-bottom: 0;
margin: 0;
}
.gameimages {
padding-bottom: 15%;
text-align: center;
}
.gameimages p {
padding-top: 20px;
}
.gameimages h3 {
text-align: center;
font-family: cambria, times new roman, sans-serif
}
#side-nav {
height: 200px;
float: right;
bottom: 1500px;
right: 3%;
padding: 10px;
background-color: #8C3406;
display: block;
position: relative;
text-align: center;
}
Please help me as I've been trying to solve this problem for 2 days. Also, this is my first time posting a question here, so forgive me if I indented my code wrongly, or if I inadvertently violated some of the rules of Stack Overflow.
The reason for this behaviour is that your drop-content has position:fixed on hover.
From MDN:
…an element that is absolutely positioned is taken out of the flow; thus, other elements are positioned as if it did not exist. The absolutely positioned element is positioned relative to its nearest positioned ancestor… Fixed positioning is similar to absolute positioning, with the exception that the element's containing block is the viewport.
Working example on JSFiddle and here is what I've changed:
#nav ul {
/*overflow: hidden;*/
}
.drop:hover .drop-content {
/*position: fixed;
top: 155px;*/
position: absolute;
}
Update CSS to
article, body, div, footer, header, h1, h2, p {
border: 0;
padding: 0;
margin: 0;
}
html, body {
height: 100%;
margin: 0;
width: 100%;
background-color: #FFFFFF;
padding: 0px;
overflow-x: hidden;
}
body {
transition: background 600s ease-in-out;
}
body:hover {
background-color: #4B0101;
}
/*main title*/
#main-title {
background-color: #33B2E7;
color: #FFFFFF;
position: relative;
top: 25px;
left: 20px;
padding: 10px;
margin-left: 10px;
display: inline-block;
transition: color 1s, transform 1s;
transition-delay: 2s;
}
#main-title:hover {
color: black;
transform: rotate(360deg);
}
/* Nav */
#nav nav{
padding-top: 100px;
margin-bottom: 0;
}
#nav ul {
list-style-type: none;
margin: 0;
background-color: #1C86EE;
padding: 0;
position: relative;
width: 100%;
bottom: 40px;
display: inline-block;
}
#nav li {
float: left;
width: 16%;
}
li a, .dropbtn {
display: inline-block;
color: #FFFFFF;
text-align: center;
padding-left: 50px;
padding-right: 50px;
text-decoration: none;
}
.active {
background-color: #6CCC0A;
padding-right: 50px;
}
li a:hover, .drop:hover .dropbtn {
background-color: #BFA811;
}
a {
padding-top: 10px;
padding-bottom: 10px;
}
li.drop {
display: inline-block;
}
.drop-content {
display: none;
position: absolute;
background-color: #970707;
min-width: 50px;
box-shadow: 0px 8px 16px 0px #000000;
z-index: 100;
}
.drop-content a {
color: #FFFFFF;
padding: 15px 20px;
display: block;
text-align: left;
}
.drop-content a:hover {
background-color: #02BBC4
}
.drop:hover .drop-content {
display: block;
}
/*banner*/
.image {
position: relative;
width: 100%;
}
.image h2 {
position: absolute;
top: 600px;
text-align: center;
width: 100%;
right: 350px;
}
.image h2 span {
color: #FFFFFF;
font: Arial, Calibri, Sans-serif;
background: #000000;
padding: 10px;
}
.image h2:hover span {
background-color: #003316;
}
.button {
position: absolute;
top: 1013px;
left: 700px;
padding: 16px 32px;
text-align: center;
margin: 4px 2px;
display: inline-block;
cursor: pointer;
background-color: rgb(41,120,104);
color: rgb(240,144,22);
font-family: Cambria, Times New Roman, serif;
font-size: 20px;
}
/*content*/
#home-content {
position: relative;
padding: 20px;
text-align: center;
margin-left: 90px;
display: block;
color: #8A0707
}
#home-content a {
color: #09922A
}home-content a:visited {
color: #000000
}
/*Footer*/
#footer {
background: #000000;
width: 100%;
height: 40px;
position: relative;
bottom: 0;
left: 0;
padding-top: 10px;
overflow: hidden;
}
#footer p {
font-family: arial, calibri, sans-serif;
color: #FFFFFF;
text-align: center;
}
#aboutme h2 {
margin-bottom: 20px;
text-align: center;
text-decoration: underline;
font-family: Cambria, Calibri, sans-serif;
font-size: 20px;
color: #000000;
}
#aboutme article {
padding-top: 20px;
position: relative;
margin-left: 25%;
margin-right: 25%;
display: inline-block;
font-family: arial, cambria, serif;
line-height: 200%;
color: #777000;
text-align: center;
border: 2px solid #000000;
padding: 10px;
}
#gallery-title {
text-align: center;
font-family: Cambria, calibri, sans-serif;
padding-top: 20px;
}
#image-1 {
text-align: center;
margin: 0 25%;
padding: 20px;
}
.img-desc-1 {
padding: 20px;
color: #047615;
}
#image-2 {
text-align: center;
margin: 0 25%;
border: 2px solid #262020;
padding: 20px;
}
#prompt-text {
text-align: center;
padding-top: 30px;
font-family: cambria, calibri, sans-serif;
}
.image-container img{
height: 300px;
width: 300px;
padding-left: 60px;
padding-top: 60px;
}
.image-container p{
padding-left: 80px;
font-family: Arial, cambria, sans-serif;
color: #560404;
text-decoration: none;
}
.image-container {
display: block;
text-align: center;
padding-left: 20px;
}
#image1 {
padding-right: 60px;
padding-bottom: 10%
}
#image2 {
padding-right: 60px;
padding-bottom: 10%;
}
#image3 {
padding-bottom: 0;
margin: 0;
}
.gameimages {
padding-bottom: 15%;
text-align: center;
}
.gameimages p {
padding-top: 20px;
}
.gameimages h3 {
text-align: center;
font-family: cambria, times new roman, sans-serif
}
#side-nav {
height: 200px;
float: right;
bottom: 1500px;
right: 3%;
padding: 10px;
background-color: #8C3406;
display: block;
position: relative;
text-align: center;
}
2 changes done.
Removed overflow:hidden in #nav ul
Keot display:block only in .drop:hover .drop-content
I am able to display two span text elements over the image when I hover over with my cursor successfully. But I am having trouble placing a button that is centered over the image, below the project name. Any help would be appreciated. I should also note the button that I want to use is from a Bootstrap 3 class.
Here is a demo: https://jsfiddle.net/oo1xx006/3/
Here is an example of what I want to create: http://www.devonstank.com/
HTML:
<div class="latest_projects">
<!-- My latest projects -->
<h1>My latest projects</h1>
<br>
<ul class="projects-list">
<li>
<img src="img/mudmat-global-model.jpg" alt="DOF Mudmat Lowering" width="380px" height="380px"/>
<span class="text-content">
<span class="project-type"><i>Project Type</i></span>
<span class="project-name">Project Name</span>
<!-- <span>View project</span> -->
</span>
</li>
</ul>
<br>
View more projects
</div>
CSS:
body {
padding-top: 0;
font-family: 'PT Sans', sans-serif;
background-color: white;
}
h1 {
/* margin: 15px 0;*/
font-size: 1.9em;
font-weight: normal;
color: #000;
line-height: 120%;
text-align: center;
}
h2 {
font-size: 1.3em;
margin: -5px 0 0;
font-weight: normal;
color: #000;
text-align: center;
}
a {
text-decoration: none;
color: #000;
font-weight: bold;
}
a:hover {
text-decoration: none;
}
p {
line-height: 200%;
padding: 0 10% 0 10%;
font-size: 1.1em;
text-align: center;
}
.btn-default {
border-color: #000;
border-radius: 0;
border-width: 2px;
color: #000;
font-size: 1.5em;
}
.btn-default:hover {
color: #fff;
background-color: #000;
border-color: #000;
border-radius: 0;
border-width: 2px;
}
img {
max-width: 100%;
}
/************************************
HOME
************************************/
.latest_projects {
text-align: center;
max-width: 1200px;
margin: 0 auto;
}
.latest_projects p {
margin: 0;
color: transparent;
}
.fluid-container img {
height: 350px;
width: 350px;
margin-bottom: 20px;
vertical-align: middle;
}
/*******Project Images******/
ul.projects-list {
list-style-type: none;
margin: 0;
padding: 0;
text-align: center;
}
ul.projects-list li {
display: inline-block;
height: 380px;
position: relative;
width: 380px;
}
span.text-content {
background: rgba(0,0,0,0.5);
color: white;
cursor: pointer;
display: table;
height: 380px;
left: 0;
position: absolute;
top: 0;
width: 380px;
}
span.text-content span {
display: table-cell;
text-align: center;
vertical-align: middle;
}
span.text-content {
background: rgba(0,0,0,0.5);
color: white;
cursor: pointer;
display: table;
height: 380px;
left: 0;
position: absolute;
top: 0;
width: 380px;
opacity: 0;
}
ul.projects-list li:hover span.text-content {
opacity: 1;
}
span.text-content {
background: rgba(0,0,0,0.5);
color: white;
cursor: pointer;
display: table;
height: 380px;
left: 0;
position: absolute;
top: 0;
width: 380px;
opacity: 0;
-webkit-transition: opacity 500ms;
-moz-transition: opacity 500ms;
-o-transition: opacity 500ms;
transition: opacity 500ms;
}
span.project-type {
position: absolute;
text-align: center;
/*margin: 25px 0;*/
padding: 120px;
width: 380px;
vertical-align: middle;
font-size: 1.7em;
}
span.project-name {
font-size: 2.5em;
}
span.view-project {
position: absolute;
text-align: center;
/*margin: 25px 0;*/
padding: 10px;
width: 380px;
vertical-align: middle;
font-size: 1.7em;
}
You can do that with Javascript. Basically you have a container, inside which you need to see/use extra content if you hover on it. I suggest that you should add the needed html, but with display: none; CSS rule, and then you need to show it when the user hovers the container and hide it if the use leaves the container. This is how you can do it with jQuery:
$(".yourcontainerclass").mouseenter(function() {
$(this).find(".yourinnerclass").hide();
});
$(".yourcontainerclass").mouseout(function() {
$(this).find(".yourinnerclass").show();
});
I tried to add a background image to the span but, for some reason, it doesn't seem to be properly loading. The jsfiddle is below.
P.S-I know its kinda straight "it doesn't works question" just got stuck for a while couldn't find a answer
http://jsfiddle.net/whnb3yf2/46/
<div class="learn">
<a>Learn More</a>
<span></span>
</div>
.learn
{
width: 200px;
height: 60px;
font-family: 'Open Sans',sans-serif;
background-color: transparent;
border:2px solid #fff;
position: relative;
text-align: center;
font-size: 18pt;
line-height:60px;
overflow: hidden;
}
.learn a
{
color: white;
display: block;
transition: all 0.2s ease-in-out;
}
.learn:hover {
background-color: white;
}
.learn:hover a
{
color: black;
margin-left: -20px;
}
.learn span
{
background:url(https://cdn4.iconfinder.com/data/icons/ionicons/512/icon-ios7-arrow-forward-128.png) center;
display: block;
width: 9px;
height: 16px;
position: absolute;
top: 22px;
left: 110%;
transition: all 0.2s ease-in-out;
}
.learn:hover span{
left: 80%;
}
body {
background-color: black;
}
You need to add background-size: 9px 16px; to your .learn span rule.
.learn {
width: 200px;
height: 60px;
font-family: 'Open Sans',sans-serif;
background-color: transparent;
border:2px solid #fff;
position: relative;
text-align: center;
font-size: 18pt;
line-height:60px;
overflow: hidden;
}
.learn a {
color: white;
display: block;
transition: all 0.2s ease-in-out;
}
.learn:hover {
background-color: white;
}
.learn:hover a {
color: black;
margin-left: -20px;
}
.learn span {
background:url(https://cdn4.iconfinder.com/data/icons/ionicons/512/icon-ios7-arrow-forward-128.png) center center;
background-size: 9px 16px;
display: block;
width: 9px;
height: 16px;
position: absolute;
top: 22px;
left: 110%;
transition: all 0.2s ease-in-out;
}
.learn:hover span{
left: 80%;
}
body {
background-color: black;
}
<div class="learn">
<a>Learn More</a>
<span></span>
</div>
The issue you are having is that the background image for the button is too small. You can fix that by setting the background size equal to that of the button. For more information on the background-size attribute, check out http://www.w3schools.com/cssref/css3_pr_background-size.asp
.learn {
width: 200px;
height: 60px;
font-family: 'Open Sans',sans-serif;
background-color: transparent;
border:2px solid #fff;
position: relative;
text-align: center;
font-size: 18pt;
line-height:60px;
overflow: hidden;
}
.learn a {
color: white;
display: block;
transition: all 0.2s ease-in-out;
}
.learn:hover {
background-color: white;
}
.learn:hover a {
color: black;
margin-left: -20px;
}
.learn span {
background:url(https://cdn4.iconfinder.com/data/icons/ionicons/512/icon-ios7-arrow-forward-128.png) center center;
background-size: 9px 15px;
display: block;
width: 9px;
height: 16px;
position: absolute;
top: 22px;
left: 110%;
transition: all 0.2s ease-in-out;
}
.learn:hover span{
left: 80%;
}
body {
background-color: black;
}
<div class="learn">
<a>Learn More</a>
<span></span>
</div>