Good day, guys, I tried to work on my code and I wasn't able to fix it on my own, the class .hello2 and .more are not showing on the page whereas it should appear below the id="flip" content, which happened it disappear the .hello2 and .more class element, it was my first time to use animation this time guys. here's the code that I been using. Looking forward
.possible {
color: #fff;
text-align: center;
letter-spacing: 10px;
text-transform: uppercase;
padding-top: 2rem;
font-family: "Coiny", sans-serif;
}
.circle {
position: relative;
border-radius: 50%;
width: 30rem;
height: 30rem;
background-color: #6CA9A5;
margin: 5rem auto;
}
.hello, .hello2 {
position: relative;
text-transform: uppercase;
font-family: "Montserrat", sans-serif;
font-weight: 900;
letter-spacing: .2rem;
font-size: 2.5rem;
color: #fff;
text-align: center;
padding-top: 100px;
/* z-index: 1; */
}
.hello span:hover {
color: #f4511e;
transition: .59s;
}
.circle a {
font-size: 15px;
text-decoration: none;
}
/* .more a {
height: 150px;
width: 500px;
background-color: #fff;
} */
#container {
color:#999;
text-transform: uppercase;
font-family: "Montserrat", sans-serif;
font-size:36px;
font-weight:bold;
padding-top:180px;
position: relative;
width:100%;
bottom:45%;
display:block;
text-align: center;
}
#flip {
height:60px;
overflow:hidden;
}
#flip > div > div {
border-radius: 30px;
color:#fff;
padding:4px 15px;
height:45px;
margin-bottom:45px;
display:inline-block;
}
#flip div:first-child {
animation: show 5s linear infinite;
}
#flip div div {
background:#42c58a;
}
#flip div:first-child div {
background:#4ec7f3;
}
#flip div:last-child div {
background:#DC143C;
}
#keyframes show {
0% {margin-top:-270px;}
5% {margin-top:-180px;}
33% {margin-top:-180px;}
38% {margin-top:-90px;}
66% {margin-top:-90px;}
71% {margin-top:0px;}
99.99% {margin-top:0px;}
100% {margin-top:-270px;}
}
<div class="content">
<h1 class="possible">Everything is Possible</h1>
<div class="circle">
<p class="hello">Let's Make </p>
<div id="container">
<div id="flip">
<div><div>wOrK</div></div>
<div><div>lifeStyle</div></div>
<div><div>Everything</div></div>
</div>
</div>
<p class="hello2">Awesome</p>
Read More
</div>
</div>
I added position:absolute to .hello2
.possible {
color: #fff;
text-align: center;
letter-spacing: 10px;
text-transform: uppercase;
padding-top: 2rem;
font-family: "Coiny", sans-serif;
}
.circle {
position: relative;
border-radius: 50%;
width: 30rem;
height: 30rem;
background-color: #6CA9A5;
margin: 5rem auto;
}
.hello, .hello2 {
position: relative;
text-transform: uppercase;
font-family: "Montserrat", sans-serif;
font-weight: 900;
letter-spacing: .2rem;
font-size: 2.5rem;
color: #fff;
text-align: center;
padding-top: 100px;
/* z-index: 1; */
}
/* I added */
.hello2 {
position:absolute;
top:80px; /* changeable */
left:50%;
transform:translateX(-50%);
}
/* I added */
.hello span:hover {
color: #f4511e;
transition: .59s;
}
.circle a {
font-size: 15px;
text-decoration: none;
}
/* .more a {
height: 150px;
width: 500px;
background-color: #fff;
} */
#container {
color:#999;
text-transform: uppercase;
font-family: "Montserrat", sans-serif;
font-size:36px;
font-weight:bold;
padding-top:180px;
position: relative;
width:100%;
bottom:45%;
display:block;
text-align: center;
}
#flip {
height:60px;
overflow:hidden;
}
#flip > div > div {
border-radius: 30px;
color:#fff;
padding:4px 15px;
height:45px;
margin-bottom:45px;
display:inline-block;
}
#flip div:first-child {
animation: show 5s linear infinite;
}
#flip div div {
background:#42c58a;
}
#flip div:first-child div {
background:#4ec7f3;
}
#flip div:last-child div {
background:#DC143C;
}
#keyframes show {
0% {margin-top:-270px;}
5% {margin-top:-180px;}
33% {margin-top:-180px;}
38% {margin-top:-90px;}
66% {margin-top:-90px;}
71% {margin-top:0px;}
99.99% {margin-top:0px;}
100% {margin-top:-270px;}
}
<div class="content">
<h1 class="possible">Everything is Possible</h1>
<div class="circle">
<p class="hello">Let's Make </p>
<div id="container">
<div id="flip">
<div><div>wOrK</div></div>
<div><div>lifeStyle</div></div>
<div><div>Everything</div></div>
</div>
</div>
<p class="hello2">Awesome</p>
Read More
</div>
</div>
Related
I'm in the process of playing with css a bit. Unfortunately, it doesn't look quite the way I'd like it to yet. The speech bubble should be smaller and directly above them. The other reason is the rotation when the mouse pointer goes over the speech bubble the complete speech bubble should rotate. Unfortunately, when you rotate it, everything else looks like a speech bubble....
How do I make the bubble smaller and put it over them and how do I make the rotation look better.
HTML
#import url('https://fonts.googleapis.com/css?family=Montserrat:400,800');
body {
padding: 50px;
font-family: 'Montserrat', sans-serif;
}
.spinner-text {
color: #fff;
}
.spinning {
color: #fff;
}
.spinning:hover {
width: 100px;
height: 100px;
color: #fff;
background-color: #5869FF;
animation-name: spin;
animation-duration: 5000ms;
animation-iteration-count: infinite;
animation-timing-function: linear;
/* transform: rotate(3deg); */
/* transform: rotate(0.3rad);/ */
/* transform: rotate(3grad); */
/* transform: rotate(.03turn); */
}
#keyframes spin {
from {
transform:rotate(0deg);
}
to {
transform:rotate(360deg);
}
}
.bubble {
position: relative;
font-family: sans-serif;
font-size: 18px;
line-height: 24px;
width: 300px;
color: #fff;
background: #5869FF;
border-radius: 40px;
padding: 24px;
text-align: center;
color: #000;
}
.bubble-bottom-left:before {
content: "";
width: 0px;
height: 0px;
position: absolute;
border-left: 24px solid #5869FF;
border-right: 12px solid transparent;
border-top: 12px solid #5869FF;
border-bottom: 20px solid transparent;
left: 32px;
bottom: -24px;
}
.blue {
color: #5869FF;
}
.black {
color: #3B3B3B;
}
.text {
text-align: center;
display: flex;
margin-top: 35px;
}
<div>
<div class="spinning">
<div class="bubble bubble-bottom-left" contenteditable>
<div class="spinner-text">
:)
</div>
</div>
</div>
<div class="text">
<div class="blue">this</div>
<div class="black">is</div>
<div class="blue">name</div>
</div>
</div>
What I have
What I want
Try this, Instead of animation on .spinning div and animation on .spinner-text only
#import url('https://fonts.googleapis.com/css?family=Montserrat:400,800');
body {
padding: 50px;
font-family: 'Montserrat', sans-serif;
}
.spinner-text {
color: #fff;
}
.spinning {
margin-left: 30px;
}
.spinning:hover .bubble .spinner-text {
background-color: #5869FF;
animation-name: spin;
animation-duration: 5000ms;
animation-iteration-count: infinite;
animation-timing-function: linear;
/* transform: rotate(3deg); */
/* transform: rotate(0.3rad);/ */
/* transform: rotate(3grad); */
/* transform: rotate(.03turn); */
}
#keyframes spin {
from {
transform:rotate(0deg);
}
to {
transform:rotate(360deg);
}
}
.bubble {
position: relative;
font-family: sans-serif;
font-size: 30px;
line-height: 28px;
width: 52px;
height: 52px;
color: #fff;
padding: 0;
text-align: center;
color: #000;
}
.bubble-bottom-left:before {
content: "";
width: 0px;
height: 0px;
position: absolute;
border-left: 14px solid #5869FF;
border-right: 12px solid transparent;
border-top: 12px solid #5869FF;
border-bottom: 20px solid transparent;
left: 15px;
bottom: -20px;
}
.bubble .spinner-text {
background: #5869FF;
border-radius: 40px;
padding: 12px;
border-radius: 40px;
}
.blue {
color: #5869FF;
}
.black {
color: #3B3B3B;
}
.text {
text-align: center;
display: flex;
margin-top: 20px;
font-weight: bold;
font-size: 20px;
}
<div>
<div class="spinning">
<div class="bubble bubble-bottom-left" contenteditable>
<div class="spinner-text">
:)
</div>
</div>
</div>
<div class="text">
<div class="blue">this</div>
<div class="black">is</div>
<div class="blue">name</div>
</div>
</div>
Here you have the solution which is coresponding with the screenshot of your requirements. I have modified Minals code to get a faster solution because he did really good job with fixing the rotate issue.
#import url('https://fonts.googleapis.com/css?family=Montserrat:400,800');
body {
padding: 50px;
font-family: 'Montserrat', sans-serif;
}
.spinner-text {
color: #fff;
font-size:20px;
font-weight:700;
width:40px;
}
.spinning {
margin-left: 115px;
}
.spinning:hover .bubble .spinner-text {
animation-name: spin;
animation-duration: 5000ms;
animation-iteration-count: infinite;
animation-timing-function: linear;
}
.bubble .spinner-text {
background: transparent!important;
border-radius: 40px;
padding: 10px;
border-radius: 40px;
position:absolute;
left:-10px;
bottom:2px;
}
#keyframes spin {
from {
transform:rotate(0deg);
}
to {
transform:rotate(360deg);
}
}
.bubble {
position: relative;
font-family: sans-serif;
font-size: 18px;
line-height: 24px;
width: 0px;
height:0px;
background: #5869FF;
border-radius: 40px;
padding: 21px;
text-align: center;
color: #000;
top:14px;
}
.bubble-bottom-left:before {
content: "";
width: 10px;
height: 15px;
position: absolute;
background-color: #5869ff;
left: 5px;
bottom: -8px;
border-radius: 0px 0px 100px 0px;
transform: translate(0, -5px);
}
.blue {
color: #5869FF;
font-size:25px;
font-weight:600;
}
.black {
color: #3B3B3B;
font-size:25px;
font-weight:600;
}
.text {
text-align: center;
display: flex;
margin-top: 20px;
font-weight: bold;
font-size: 20px;
}
<div>
<div class="spinning">
<div class="bubble bubble-bottom-left" contenteditable>
<div class="spinner-text">
:)
</div>
</div>
</div>
<div class="text">
<div class="blue">this</div>
<div class="black">is</div>
<div class="blue">name</div>
</div>
</div>
You need to set a transform origin by transform-origin: 0% 0% to rotate element in center or what point you want to transform.
See JSFiddle Sample
body {
padding: 50px;
font-family: "Montserrat", sans-serif;
}
.spinner-text {
color: #fff;
}
.spinning {
color: #fff;
position: absolute;
bottom: 28px;
left: 80px;
width: 40px;
height: 40px;
}
.spinning:hover {
cursor: default;
color: #fff;
animation-name: spin;
animation-duration: 5000ms;
animation-iteration-count: infinite;
animation-timing-function: linear;
transform-origin: 50% 50%;
}
#keyframes spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
#speechBubble {
display: block;
position: relative;
}
.bubble {
position: absolute;
font-family: sans-serif;
font-size: 18px;
line-height: 20px;
width: 20px;
height: 20px;
color: #fff;
background: #5869ff;
border-radius: 50%;
padding: 10px;
text-align: center;
}
.bubble-bottom-left:before {
content: "";
width: 6px;
height: 18px;
position: absolute;
background-color: #5869ff;
transform: rotate(35deg);
left: 15px;
bottom: -8px;
border-radius: 0px 0px 40px 0px;
}
.blue {
color: #5869ff;
}
.black {
color: #3b3b3b;
}
.text {
text-align: center;
display: flex;
margin-top: 35px;
font-weight: 600;
font-size: 20px;
}
/* EOS */
<div id="speechBubble">
<div class="spinning">
<div class="bubble bubble-bottom-left" contenteditable>
<div class="spinner-text">
:)
</div>
</div>
</div>
<div class="text">
<div class="blue">this</div>
<div class="black">is</div>
<div class="blue">name</div>
</div>
</div>
I created some background images in a div with slideshow and some content displaying on that, and now I'm trying to add a section right below my background image but anything I add after my background div in my html, locates behind my background image and top of my window as if I've had created no content in my webpage before this section except a navbar with sticky position. I put my codes here for better perception.
I'm trying to create content just after my background image as different, separated parts of my webpage, does anyone have an idea?
P.S: My main focus is running this web on full screen windows so please excuse my cluttered code result in non-full-screen windows.
*,
*::before,
*::after{
padding: 0;
margin: 0;
box-sizing: border-box;
}
body{
background-color: aqua;
}
header{
z-index: 999999999;
overflow: hidden;
position: sticky;
top: -31px;
}
header .header_main{
background-color: rgba(255,255,255,0.98);
}
header div.header_meta{
font-family: 'Open Sans', sans-serif;
font-weight: bold;
font-size: 11px;
border-bottom: 1px solid rgba(224, 224, 224, 0.56);
}
header div.container{
line-height: 30px;
width: 90%;
margin: auto;
padding: 0 50px;
}
header div.container nav ul{
line-height: 30px;
margin: 0 auto;
float: right;
}
header div.container nav ul li{
float: right;
list-style: none;
}
header div.container nav ul li a{
text-decoration: none;
float: right;
padding: 0 10px;
color: #ffffff;
}
header div.container nav ul li a:hover{
text-decoration: underline;
color: #E6E6E6;
}
header .header_meta .header_contact{
margin: auto;
line-height: 30px;
color: #ffffff;
}header .header_main{
box-shadow: 0 3px 4px -4px rgba(138, 138, 138, 0.65);
}
header .header_main .container_logo_nav{
width: 90%;
height: 60px;
line-height: 60px;
margin: 0 auto;
padding: 0 4%;
}
header .header_main .container_logo_nav img{
height: 100%;
width: 216px;
float: left;
}
header .header_main .container_logo_nav ul{
float: right;
padding-right: 1%;
}
header .header_main .container_logo_nav ul li{
float: right;
list-style: none;
}
header .header_main .container_logo_nav ul li a{
text-decoration: none;
font-family: 'Open Sans', sans-serif;
font-weight: bolder;
font-size: 14px;
color: #6E6E6E;
padding: 0 13px;
transition: 300ms;
}
header .header_main .container_logo_nav ul li a.search{
font-size: 11px;
}
header .header_main .container_logo_nav ul li a:hover{
color: #000000;
}
.container_slider{
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 82vh;
animation: animate 35s ease-in-out infinite;
background-size: cover;
background: no-repeat center;
clear: both;
display: block;
}
.container_slider::before{
width: 100%;
height: 100%;
content:"";
background-color: rgba(22,22,22,0.2);
position: absolute;
top: 0;
}
#keyframes animate{
0%,100%{
background-image: url("Background_Image1");
}
20%{
background-image: url("Background_Image2");
}
40%{
background-image: url("Background_Image3");
}
60%{
background-image: url("Background_Image4");
}
80%{
background-image: url("Background_Image5");
}
}
.container_slider .outer{
width: 100%;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50% , -50%);
text-align: center;
}
.container_slider .outer .details{
}
.container_slider .outer .details h1{
font-family: 'Finger Paint', cursive;
font-weight: lighter;
color: #ffffff;
font-size: 70px;
line-height: 77px;
padding: 15px 0;
animation: caption 600ms ease-in-out 1;
}
#keyframes caption {
0%{
transform: translate(0, -20px);
opacity: 0;
}
100%{
transform: translate(0, 0);
opacity: 1;
}
}
.container_slider .outer .details span{
font-family: 'Open Sans';
font-weight: 600;
font-size: 16px;
color: #ffffff;
display: block;
animation: ltlspan 600ms linear 1;
}
#keyframes ltlspan {
0%{
transform: translate(0, 20px);
opacity: 0;
}
100%{
transform: translate(0, 0);
opacity: 1;
}
}
.container_slider .outer .buttons{
width: 100%;
margin-top: 40px;
}
.container_slider .outer a{
background-color: #f8f8f8;
width: 152px;
height: 46px;
line-height: 23px;
border-radius: 100px;
padding: 10px 20px;
margin: 0 10px;
text-decoration: none;
font-family: 'Open Sans', sans-serif;
font-size: 12px;
font-weight: bold;
display: inline-block;
text-align: center;
transition: 300ms;
color: #666666;
animation: abuttons 1300ms ease-in 1;
}
#keyframes abuttons {
0%{
transform: translate(0, -20px);
opacity: 0;
}
100%{
transform: translate(0, 0);
opacity: 1;
}
}
.container_slider .outer a:first-child{
background-color: #109bc5;
color: #ffffff;
border-bottom: 1px solid #0079a3;
}
.container_slider .outer a:first-child:hover{
background-color: rgba(16, 156, 198, 0.9);
}
.container_slider .outer a:nth-child(2):hover{
background-color: rgba(255, 255, 255, 0.86);
color: black;
}
div.box{
width: 100px;
height: 100px;
background-color: blue;
/* I want this box to be displayed below my background image */
}
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Open+Sans:wght#300&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Open+Sans+Condensed:wght#700&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Finger+Paint&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/all.min.css">
<link href="https://fonts.googleapis.com/css2?family=Open+Sans:wght#600&display=swap" rel="stylesheet">
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<header>
<div class="header_meta">
<div class="container">
<nav>
<ul>
<li> Registration </li>
<li> Customer Login </li>
</ul>
</nav>
<div class="header_contact"> <span>Call us now: 555-147-5643</span> </div>
</div>
</div>
<div class="header_main">
<div class="container_logo_nav">
<span class="logo"> <img src="images/logo-large.png" alt=""> </span>
<nav class="main_menu">
<ul>
<li><a class="search" href="#"><i class="fa fa-search"></i></a></li>
<li>News</li>
<li>Contact</li>
<li>About</li>
<li>Deals</li>
<li>Destinations</li>
<li>Welcome</li>
</ul>
</nav>
</div>
</div>
</header>
<div class="container_slider">
<div class="outer">
<div class="details">
<h1>To Travel is to live</h1>
<h2>
<span>Want to make a journey? We got the destinations!</span>
</h2>
</div>
<div class="buttons">
ALL DESTINATIONS
LATEST OFFERS
</div>
</div>
</div>
<div class="box"></div>
</body>
</html>
You have set your wrapper to position absolute together with inner. I have changed the .container_slider to relative to wrap properly your slider and box.
[screenshot of the result][1]
here is a screenshot: https://i.stack.imgur.com/8hTNT.jpg
*,
*::before,
*::after {
padding: 0;
margin: 0;
box-sizing: border-box;
}
body {
background-color: aqua;
}
header {
z-index: 999999999;
overflow: hidden;
position: sticky;
top: -31px;
}
header .header_main {
background-color: rgba(255, 255, 255, 0.98);
}
header div.header_meta {
font-family: 'Open Sans', sans-serif;
font-weight: bold;
font-size: 11px;
border-bottom: 1px solid rgba(224, 224, 224, 0.56);
}
header div.container {
line-height: 30px;
width: 90%;
margin: auto;
padding: 0 50px;
}
header div.container nav ul {
line-height: 30px;
margin: 0 auto;
float: right;
}
header div.container nav ul li {
float: right;
list-style: none;
}
header div.container nav ul li a {
text-decoration: none;
float: right;
padding: 0 10px;
color: #ffffff;
}
header div.container nav ul li a:hover {
text-decoration: underline;
color: #e6e6e6;
}
header .header_meta .header_contact {
margin: auto;
line-height: 30px;
color: #ffffff;
}
header .header_main {
box-shadow: 0 3px 4px -4px rgba(138, 138, 138, 0.65);
}
header .header_main .container_logo_nav {
width: 90%;
height: 60px;
line-height: 60px;
margin: 0 auto;
padding: 0 4%;
}
header .header_main .container_logo_nav img {
height: 100%;
width: 216px;
float: left;
}
header .header_main .container_logo_nav ul {
float: right;
padding-right: 1%;
}
header .header_main .container_logo_nav ul li {
float: right;
list-style: none;
}
header .header_main .container_logo_nav ul li a {
text-decoration: none;
font-family: 'Open Sans', sans-serif;
font-weight: bolder;
font-size: 14px;
color: #6e6e6e;
padding: 0 13px;
transition: 300ms;
}
header .header_main .container_logo_nav ul li a.search {
font-size: 11px;
}
header .header_main .container_logo_nav ul li a:hover {
color: #000000;
}
.container_slider {
position: relative; /*changed to relative*/
top: 0;
left: 0;
width: 100%;
height: 82vh;
animation: animate 35s ease-in-out infinite;
background-size: cover;
background: no-repeat center;
clear: both;
display: block;
}
.container_slider::before {
width: 100%;
height: 100%;
content: '';
background-color: rgba(22, 22, 22, 0.2);
position: absolute;
top: 0;
}
#keyframes animate {
0%,
100% {
background-image: url('https://www.pexels.com/photo/green-leaf-plant-808510/');
}
20% {
background-image: url('https://www.pexels.com/photo/green-leaf-plant-808510/');
}
40% {
background-image: url('https://www.pexels.com/photo/green-leaf-plant-808510/');
}
60% {
background-image: url('https://www.pexels.com/photo/green-leaf-plant-808510/');
}
80% {
background-image: url('https://www.pexels.com/photo/green-leaf-plant-808510/');
}
}
.container_slider .outer {
width: 100%;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
text-align: center;
}
.container_slider .outer .details {
}
.container_slider .outer .details h1 {
font-family: 'Finger Paint', cursive;
font-weight: lighter;
color: #ffffff;
font-size: 70px;
line-height: 77px;
padding: 15px 0;
animation: caption 600ms ease-in-out 1;
}
#keyframes caption {
0% {
transform: translate(0, -20px);
opacity: 0;
}
100% {
transform: translate(0, 0);
opacity: 1;
}
}
.container_slider .outer .details span {
font-family: 'Open Sans';
font-weight: 600;
font-size: 16px;
color: #ffffff;
display: block;
animation: ltlspan 600ms linear 1;
}
#keyframes ltlspan {
0% {
transform: translate(0, 20px);
opacity: 0;
}
100% {
transform: translate(0, 0);
opacity: 1;
}
}
.container_slider .outer .buttons {
width: 100%;
margin-top: 40px;
}
.container_slider .outer a {
background-color: #f8f8f8;
width: 152px;
height: 46px;
line-height: 23px;
border-radius: 100px;
padding: 10px 20px;
margin: 0 10px;
text-decoration: none;
font-family: 'Open Sans', sans-serif;
font-size: 12px;
font-weight: bold;
display: inline-block;
text-align: center;
transition: 300ms;
color: #666666;
animation: abuttons 1300ms ease-in 1;
}
#keyframes abuttons {
0% {
transform: translate(0, -20px);
opacity: 0;
}
100% {
transform: translate(0, 0);
opacity: 1;
}
}
.container_slider .outer a:first-child {
background-color: #109bc5;
color: #ffffff;
border-bottom: 1px solid #0079a3;
}
.container_slider .outer a:first-child:hover {
background-color: rgba(16, 156, 198, 0.9);
}
.container_slider .outer a:nth-child(2):hover {
background-color: rgba(255, 255, 255, 0.86);
color: black;
}
div.box {
width: 100px;
height: 100px;
background-color: blue;
/* I want this box to be displayed below my background image */
}
I used to do my best to solve the problem, however, it doesn't work. As you can see, if you run the code the animation is not inline or they are not in proper position, what I want to - the animation should be in between or centered in the Let's Make and Awesome elements. Looking forward and answer and if you mind can you please explain to make so that i will understand it fully. Thank You so much
.circle {
position: relative;
border-radius: 50%;
width: 30rem;
height: 30rem;
background-color: #6CA9A5;
margin: 5rem auto;
}
.hello, .hello2 {
position: relative;
text-transform: uppercase;
font-family: "Montserrat", sans-serif;
font-weight: 900;
letter-spacing: .2rem;
font-size: 1.5rem;
color: #fff;
text-align: center;
padding: 70px 0 2px 0;
/* z-index: 1; */
}
.hello2 {
position:absolute;
top: 58px; /* changeable */
left:50%;
transform:translateX(-50%);
}
.hello span:hover {
color: #f4511e;
transition: .59s;
}
.circle a {
position: absolute;
top:60%; /* changeable */
left:50%;
transform:translateX(-50%);
font-size: 15px;
text-decoration: none;
background: #fff;
padding: 15px 35px;
border-radius: 35px;
text-transform: uppercase;
}
/* .more a {
height: 150px;
width: 500px;
background-color: #fff;
} */
#container {
color:#999;
text-transform: uppercase;
font-family: "Montserrat", sans-serif;
font-size: 1.5rem;
font-weight: bold;
padding-top: 200px;
position: relative;
width:100%;
bottom: 45%;
display:block;
text-align: center;
}
#flip {
height: 80px;
overflow:hidden;
}
#flip > div > div {
border-radius: 30px;
color:#fff;
padding:4px 15px 4px 15px;
height:30px;
margin-bottom: 62px;
display:inline-block;
}
#flip > div > .ever {
/* height: 59px; */
}
#flip div:first-child {
animation: show 5s linear infinite;
}
#flip div div {
background:#42c58a;
}
#flip div:first-child div {
background:#4ec7f3;
}
#flip div:last-child div {
background:#DC143C;
}
#keyframes show {
0% {margin-top:-270px;}
5% {margin-top:-180px;}
33% {margin-top:-180px;}
38% {margin-top:-90px;}
66% {margin-top:-90px;}
71% {margin-top:0px;}
99.99% {margin-top:0px;}
100% {margin-top:-270px;}
}
<div class="content">
<h1 class="possible">Everything is Possible</h1>
<div class="circle">
<p class="hello">Let's Make </p>
<div id="container">
<div id="flip">
<div><div>wOrK</div></div>
<div><div>lifeStyle</div></div>
<div><div class="ever">Everything</div></div>
</div>
</div>
<p class="hello2">Awesome</p>
Read More
</div>
</div>
I'm trying to create a hover effect that will change the color of the image to blue, as the mouse hovers it. I've already created a class for the images and styled it in my css but its still not working. I've also tried changing z-indexes but to no avail.
#import url(http://fonts.googleapis.com/css?family=Black+Ops+One:400,700); /*--- Header --*/
#import url(http://fonts.googleapis.com/css?family=Open+Sans:400,700); /*--- Navigation --*/
*
{
margin: 0;
border: 0;
padding: 0;
}
body
{
background-image: url('../Images/background.png');
background-repeat: repeat-x;
}
.clearfix
{
clear:both;
}
#wrapper
{
margin: 0 auto;
max-width: 1120px;
overflow: auto;
border: 1px solid black;
}
#main_header
{
width: 100%;
font-family: 'Black Ops One', sans-serif;
background-color: black;
border: 1px solid black;
color: white;
}
#main_header h1
{
float: left;
font-size: 380%;
margin: -10% 0 0 2%;
}
#callout
{
margin: 50px 20px 0 0;
}
#callout h2{
text-align: right;
color: white;
}
#callout p{
text-align: right;
padding: 0%;
color: grey;
font-size: 20px;
margin-bottom: 3px;
}
#nav_menu
{
width: 100%;
height: 10%;
background-color: white;
}
#nav_menu li
{
display: inline-block;
margin: 20px 20px 20px 63px;
font-family: 'Open Sans', sans-serif;
font-size: 20px;
font-weight: bold;
}
#nav_menu li a
{
text-decoration: none;
color: black;
}
#nav_menu li a:hover
{
color: grey;
}
#content_area
{
width: 100%;
margin: 10px;
}
.sub-menu
{
position: absolute;
background-color: white;
list-style-type: none;
width: 5px;
display: none;
z-index: 60;
border-radius: 15px;
}
#nav_menu .sub-menu li a
{
color: black;
}
#nav_menu li:hover .sub-menu
{
display: block;
}
#nav_menu li .sub-menu
{
width: 16.5%;
}
#nav_menu li .sub-menu li
{
display: block;
margin-left: 20px;
}
.sub-menu li:hover
{
color: green;
background-color: yellow;
}
/*--- Start Image Slider --*/
.slider{
max-width: 1100px;
box-shadow: 0px 0px 0px 0 rgba(0, 0, 0, 0.07);
}
.slider1 img{
width: 100%;
margin: 0 auto;
}
.slider .bx-wrapper .bx-controls-direction a{
outline: 0 none;
position: absolute;
text-indent: -9999px;
top: 40%;
height: 71px;
width: 40px;
transition: all 0.7s;
}
.slider .bx-wrapper:hover .bx-controls-direction a{
}
.slider .bx-wrapper .bx-prev{
background: url("../Images/arrow_left.png") no-repeat 7px 9px;
left: 0px;
}
.slider .bx-wrapper .bx-prev:hover{
background: url("../Images/arrow_left.png") no-repeat 8px 15px;
}
.slider .bx-wrapper .bx-next{
background: url("../Images/arrow_right.png") no-repeat 10px 12px;
right: 0px;
}
.slider .bx-wrapper .bx-next:hover{
background: url("../Images/arrow_right.png") no-repeat 10px 17px;
}
/*--- End Image Slider --*/
.one-third img{
text-align: center;
max-width: 100%;
height: auto;
opacity: 0.9;
}
.border_section p{
font-family: 'Lato', sans-serif;
padding: 2%;
color: white;
text-align: justify;
}
.border_section h3
{
font-family: 'Open Sans', sans-serif;
text-align: center;
color: white;
text-transform: uppercase;
letter-spacing: 1%;
}
.border_section
{
border: 1px solid black;
background-color: black;
}
.one-third {
width: 27.35%;
float: left;
margin: 2% 0 3% 4%;
text-align: center;
background-color: white;
}
.guitarLogo img:hover
{
color: yellow;
background-color: blue;
}
footer{
font-family: 'Open Sans', sans-serif;
font-weight: bold;
text-align: center;
width: 100%;
height: 6%;
background-color: black;
overflow: auto;
}
footer p
{
margin-top: 1%;
color: white;
}
<div class="border_section">
<img class="guitarLogo" src="../Images/Guitar Brands/ibanezLogo.jpg" runat="server"/>
</div>
</section>
<section class="one-third">
<div class="border_section">
<img class="guitarLogo" src="../Images/Guitar Brands/fenderLogo.jpg" runat="server"/>
</div>
</section>
<section class="one-third">
<div class="border_section">
<img class="guitarLogo" src="../Images/Guitar Brands/gibsonLogo.jpg" runat="server"/>
</div>
</section>
<section class="one-third">
<div class="border_section">
<img class="guitarLogo" src="../Images/Guitar Brands/prsLogo.jpg" runat="server"/>
</div>
</section>
<section class="one-third">
<div class="border_section">
<img class="guitarLogo" src="../Images/Guitar Brands/ernieballLogo.jpg" runat="server"/>
</div>
</section>
<section class="one-third">
<div class="border_section">
<img class="guitarLogo" src="../Images/Guitar Brands/espLogo.jpg" runat="server"/>
</div>
</section>
If you don't want to affect other elements and change the background color of div element around your images, then create new class like myHover and add existing CSS to it, like:
HTML:
<div class="border_section myHover">
<img class="guitarLogo" src="../Images/Guitar Brands/fenderLogo.jpg" runat="server" />
</div>
CSS:
.myHover:hover {
color: yellow;
background-color: blue;
}
JSFiddle example: https://jsfiddle.net/59drat5e/4/
The selector would be img.guitarLogo:hover
But setting a background-color for an image will only affect the visible part around the image (if there is ANY), and color would only affect text (and there isn't any), so you will problably see no effect, even if it works.
It looks like that you are targeting the wrong element. The background-color:blue will only be visible if the image is transparent, otherwise most of the time the image will just overlap any background color for it to be visible.
What you should be doing is targetting the container element as shown below.
.border_section:hover
{
color: yellow;
background-color: blue;
}
DEMO
If you have images with transparencies or still if you want to set the background-color of the img just for the sake of it, then maybe you should write the rule as below.
img.guitarLogo:hover
{
color: yellow;
background-color: blue;
}
Try this code in your css
.guitarLogo:hover {
background: blue;
}
you can also overlay background color to image
.overlay {
position:relative;
width:400px;
height:auto;
}
.overlay img {
width:100%;
vertical-align:top;
}
.overlay:after {
content:'';
position:absolute;
width:100%;
height:100%;
top:0; left:0;
background:red;
opacity:0;
transition: all 0.5s;
-webkit-transition: all 0.5s;
}
.overlay:hover:after {
opacity:1;
}
<div class="overlay">
<img src="https://www.google.co.in/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png" alt="" />
</div>
Your CSS:
.guitarLogo img:hover {
color: yellow;
background-color: blue;
}
Is incorrect, because the .guitarLogo already targets the <img> element - no need for img:hover.
Also, that isn't going to work, because there is no way you can set z-index to background only - it's possible only for elements.
The way to do what you want is to register :hover on parent container and in it by using pseudo element :before / :after as the foreground you can get the desired effect.
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*/ }