There is background colour showing between image divs. I thought it might have something to do with margins. Even setting the div to absolute positioning and the parent to relative doesn't work. The picture still won't show without it being relative. (robot2.jpg in div sec, sectThree).
Here's the website: thomasogbourne.me
html,
body {
margin: 0px;
height: 100%;
margin-top: 0px;
margin-right: 0px;
margin-left: 0px;
background-color: #000000;
}
h1,
h2,
h3,
h4,
h5,
h6,
p {
margin-bottom: 20px;
}
/*
nav {
position: fixed;
width: 100%;
height: 50px;
background-color: rgba(0,0,0,.5);
z-index: 99;
text-align: center;
}
nav a {
text-decoration: none;
color: #fff;
margin-left: 30px;
line-height: 50px;
}*/
.sect {
position: rela;
height: 100%;
background-size: cover;
background-repeat: no-repeat;
}
.subSection {
height: 30%;
}
.smallsubSection {
height: 20%;
}
.sectOne {
background-image: url("/Images/CX750Msmall.jpg");
background-attachment: fixed;
}
.sectTwo {
background-image: url("/Images/drone.jpg");
position: relative;
top: -90px;
z-index: -1
}
.sectThree {
background-image: url("/Images/robot2.jpg");
position: absolute;
top: -150px;
background-repeat: space;
}
#aboutSection {
background: #648880;
background: linear-gradient(to right, #f6f1d3, #648880 85%, #293f50);
}
#gearSection {
background: #0083FF;
background: linear-gradient(#3943DA, #00F3FF);
height: 66%;
}
#contactSection {
background: #648880;
background: linear-gradient(#DEDEDE, #898989 85%);
}
.smallsubSection {
font-family: "Arial Narrow", Arial, sans-serif;
font-size: 24px;
font-style: normal;
font-variant: normal;
font-weight: 500;
line-height: 26.4px;
}
#bigname {
font-family: "Luckiest Guy";
font-size: 45px;
font-style: normal;
font-variant: normal;
font-weight: 500;
line-height: 26.4px;
letter-spacing: 2px;
text-decoration: overline underline;
color: #D5D5D5;
text-align: center;
position: absolute;
top: 33%;
left: 50%;
margin-right: -50%;
transform: translate(-50%, -50%);
}
/* MENU START */
nav.container {
margin: 0 auto;
padding: 30px 3em;
background-color: #000040;
position: fixed;
width: 40%;
text-align: center;
list-style: none;
margin-left: 27.5%;
z-index: 1;
}
nav.container a {
color: #fff;
text-decoration: none;
margin: 0 10px;
padding: 10px 10px;
position: relative;
z-index: 0;
cursor: pointer;
font-family: "Rockwell Extra Bold", "Rockwell Bold", monospace;
font-size: 25px;
padding: 10px;
}
nav.borderXwidth a:before,
nav.borderXwidth a:after {
position: absolute;
opacity: 0;
width: 0%;
height: 2px;
content: '';
background: #FFF;
transition: all 0.3s;
}
nav.borderXwidth a:before {
left: 0px;
top: 0px;
}
nav.borderXwidth a:after {
right: 0px;
bottom: 0px;
}
nav.borderXwidth a:hover:before,
nav.borderXwidth a:hover:after {
opacity: 1;
width: 100%;
}
/* MENU END */
.button {
background-color: #4CAF50;
/* Green */
border: none;
color: white;
padding: 13px 21px;
text-align: center;
text-decoration: none;
display: inline-block;
font-size: 24px;
margin: 4px 2px;
cursor: pointer;
transition-duration: 0.4s;
position: relative;
bottom: -90px;
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
width: 150px;
}
.button1 {
box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
}
.button2:hover {
box-shadow: 0 12px 16px 0 rgba(0, 0, 0, 0.24), 0 17px 50px 0 rgba(0, 0, 0, 0.19);
}
/* SCROLLING TEXT MAIN SECTION */
.content {
position: absolute;
top: 144%;
left: 54%;
-webkit-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
font-size: 35px;
line-height: 40px;
font-family: 'Lato', sans-serif;
color: #ecf0f1;
height: 160px;
overflow: hidden;
zoom: 3.5;
-moz-transform: scale(3.5);
}
.visible {
font-weight: 600;
overflow: hidden;
height: 40px;
padding: 0 40px;
}
.visible:before {
content: '';
left: 0;
line-height: 40px;
}
.visible:after {
content: '';
position: absolute;
right: -80px;
line-height: 40px;
}
.visible:after,
.visible:before {
position: absolute;
top: 0;
color: #16a085;
font-size: 42px;
-webkit-animation-name: opacity;
-webkit-animation-duration: 2s;
-webkit-animation-iteration-count: infinite;
-webkit-animation-name: opacity;
animation-name: opacity;
-webkit-animation-duration: 2s;
animation-duration: 2s;
-webkit-animation-iteration-count: infinite;
animation-iteration-count: infinite;
}
p {
display: inline;
float: left;
margin: 0;
left: 40px;
}
ul {
margin-top: 0;
padding-left: 230px;
text-align: left;
list-style: none;
-webkit-animation-name: change;
-webkit-animation-duration: 6s;
-webkit-animation-iteration-count: infinite;
-webkit-animation-name: change;
animation-name: change;
-webkit-animation-duration: 6s;
animation-duration: 6s;
-webkit-animation-iteration-count: infinite;
animation-iteration-count: infinite;
}
ul li {
line-height: 40px;
margin: 0;
}
li {
width: 270px
}
#-webkit-keyframes opacity {
0%,
100% {
opacity: 0;
}
50% {
opacity: 1;
}
}
#-webkit-keyframes change {
0%,
12%,
100% {
-webkit-transform: translateY(0);
transform: translateY(0);
}
17%,
29% {
-webkit-transform: translateY(-25%);
transform: translateY(-25%);
}
34%,
46% {
-webkit-transform: translateY(-50%);
transform: translateY(-50%);
}
51%,
63% {
-webkit-transform: translateY(-75%);
transform: translateY(-75%);
}
68%,
80% {
-webkit-transform: translateY(-50%);
transform: translateY(-50%);
}
85%,
97% {
-webkit-transform: translateY(-25%);
transform: translateY(-25%);
}
}
#keyframes opacity {
0%,
100% {
opacity: 0;
}
50% {
opacity: 1;
}
}
#keyframes change {
0%,
12%,
100% {
-webkit-transform: translateY(0);
transform: translateY(0);
}
17%,
29% {
-webkit-transform: translateY(-25%);
transform: translateY(-25%);
}
34%,
46% {
-webkit-transform: translateY(-50%);
transform: translateY(-50%);
}
51%,
63% {
-webkit-transform: translateY(-75%);
transform: translateY(-75%);
}
68%,
80% {
-webkit-transform: translateY(-50%);
transform: translateY(-50%);
}
85%,
97% {
-webkit-transform: translateY(-25%);
transform: translateY(-25%);
}
}
<body>
<nav class="container borderXwidth">
<a id="home" href="#homeSection">HOME</a>
<a id="about" href="#aboutSection">ABOUT</a>
<a id="gear" href="#gearSection">MY GEAR</a>
<a id="portfolio" href="#portfolioSection">PORTFOLIO</a>
<a id="contact" href="#contactSection">CONTACT</a>
</nav>
<div id="homeSection" class="sect
sectOne">
<div id="bigname">
<h1>
THOMAS OGBOURNE
</h1>
<button class="button button2 hvr-icon-hang hvr-fade">Begin</button>
</div>
</div>`
<div id="aboutSection" class="subSection">
<div class='content'>
<div class='visible'>
<p>
Hello I'm Tom:
</p>
<ul>
<li>Web Developer</li>
<li>Gamer</li>
<li>Student</li>
<li>Computer Guy</li>
</ul>
</div>
</div>
</div>
<div id="serviceSection" class="sect
sectTwo"></div>
<div id="gearSection" class="subSection2"></div>
<div id="portfolioSection" class="sect
sectThree"></div>
<div id="contactSection" class="smallsubSection">
<h2 style="margin-top:0;">
Email: *******************
</h2>
<h2>
Phone: **************
</h2>
</div>
<script src="js/jquery-3.1.1.min.js"></script>
<script src="js/app.js"></script>
</body>
Is this what you wanted? :
https://jsfiddle.net/n3h3cm1x/
Basically your code is very messy and chaotic. there is something like this in there:
<button class="button button2 hvr-icon-hang hvr-fade">Begin</button>
</div>
</div>`
<div id="aboutSection" class="subSection">
<div class='content'>
Notice that ` symbol? that was the cause of the first break between divs.
the second break between divs is
top:-90px;
which you added to few sections at the bottom.
Related
I am making this rounded scroll down button with an arrow inside. On hover I wanted to apply an animation that makes the arrow go from above to below the rounded div, and it should be hidden when outside the div.
I tried using overflow: hidden but for some reason it doesn't work. Does anyone has a solution for this please?
Codepen: https://codepen.io/RaphaelleD/pen/vYpqxpm
#keyframes tipUp {
0% {
transform: translateY(-10px) rotateZ(225deg);
}
100% {
transform: translateY(100px) rotateZ(225deg);
}
}
#keyframes lineUp {
0% {
transform: translateY(-10px);
}
100% {
transform: translateY(100px);
}
}
.scrolldown {
position: relative;
margin: 0 auto;
}
.scrolldown p {
font-size: 1rem;
font-weight: 600;
padding-bottom: 0.8rem;
text-align: center;
}
.scrolldown__arrow {
width: 6rem;
height: 6rem;
border: 6px solid black;
border-radius: 50%;
margin: 0 auto;
overflow: hidden;
}
.scrolldown__arrow:before {
position: absolute;
display: inline-block;
content: "";
background: black;
width: 10px;
height: 45px;
top: 50%;
left: 50%;
margin-top: -50px;
margin-left: -5px;
transform: translateY(50px);
}
.scrolldown__arrow:after {
position: absolute;
display: inline-block;
content: "";
width: 22px;
height: 22px;
color: black;
border-top: 9px solid;
border-left: 9px solid;
transform: rotateZ(45deg);
top: 50%;
left: 50%;
margin-top: -30px;
margin-left: -15.5px;
transform: translateY(50px) rotateZ(225deg);
}
.scrolldown__arrow:hover:before {
animation: lineUp 1s cubic-bezier(0, 0.6, 1, 0.4) infinite 0.5s;
}
.scrolldown__arrow:hover:after {
animation: tipUp 1s cubic-bezier(0, 0.6, 1, 0.4) infinite 0.5s;
}
}
}
<body>
<div class="scrolldown">
<p>SCROLL DOWN</p>
<div class="scrolldown__arrow"></div>
</div>
</body>
I believe this is because of position: absolute, which takes the arrow out of the normal flow. In order to kinda preserve it in the flow, I've added position: relative to the arrow parent, and had to adjust top position as well, seems to work as expected:
#keyframes tipUp {
0% {
transform: translateY(-10px) rotateZ(225deg);
}
100% {
transform: translateY(100px) rotateZ(225deg);
}
}
#keyframes lineUp {
0% {
transform: translateY(-10px);
}
100% {
transform: translateY(100px);
}
}
.scrolldown {
position: relative;
margin: 0 auto;
}
.scrolldown p {
font-size: 1rem;
font-weight: 600;
padding-bottom: 0.8rem;
text-align: center;
}
.scrolldown__arrow {
width: 6rem;
height: 6rem;
border: 6px solid black;
border-radius: 50%;
margin: 0 auto;
overflow: hidden;
position: relative;
}
.scrolldown__arrow:before {
position: absolute;
display: inline-block;
content: "";
background: black;
width: 10px;
height: 45px;
top: 25%;
left: 50%;
margin-top: -50px;
margin-left: -5px;
transform: translateY(50px);
}
.scrolldown__arrow:after {
position: absolute;
display: inline-block;
content: "";
width: 22px;
height: 22px;
color: black;
border-top: 9px solid;
border-left: 9px solid;
transform: rotateZ(45deg);
top: 25%;
left: 50%;
margin-top: -30px;
margin-left: -15.5px;
transform: translateY(50px) rotateZ(225deg);
}
.scrolldown__arrow:hover:before {
animation: lineUp 1s cubic-bezier(0, 0.6, 1, 0.4) infinite 0.5s;
}
.scrolldown__arrow:hover:after {
animation: tipUp 1s cubic-bezier(0, 0.6, 1, 0.4) infinite 0.5s;
}
}
}
<body>
<div class="scrolldown">
<p>SCROLL DOWN</p>
<div class="scrolldown__arrow"></div>
</div>
</body>
I was working on a custom design On WordPress website ,
But I'm stuck in a problem and I don't know how to solve it.
The end result is supposed to be like this :
result
but I am getting this result In my end :
img
The problem is that the closing (x) does not appear.
code :
/* Pop Up Animation Ramadan */
#keyframes flipInX {
from {
transform: perspective(400px) rotate3d(1, 0, 0, 90deg);
animation-timing-function: ease-in;
opacity: 0
}
40% {
transform: perspective(400px) rotate3d(1, 0, 0, -20deg);
animation-timing-function: ease-in
}
60% {
transform: perspective(400px) rotate3d(1, 0, 0, 10deg);
opacity: 1
}
80% {
transform: perspective(400px) rotate3d(1, 0, 0, -5deg)
}
to {
transform: perspective(400px)
}
}
#keyframes change_color {
0% {
background: #5ac7da
}
33.33% {
background: #3173bd
}
66.66% {
background: #0d4a8d
}
100% {
background: #5ac7da
}
}
#keyframes run_hari18 {
0% {
transform: translate(0%, 0);
opacity: 0
}
50% {
transform: translate(100%, 0);
opacity: 1
}
100% {
transform: translate(100%, 0);
opacity: 0
}
}
#keyframes sun_movement {
0% {
top: 50px
}
100% {
top: 50px
}
}
#keyframes run_malam18 {
0% {
transform: translate(-20%, 0);
opacity: 0
}
49.99% {
transform: translate(0%, 0);
opacity: 1
}
99.99% {
transform: translate(20%, 0);
opacity: 0
}
100% {
transform: translate(-20%, 0);
opacity: 1
}
}
#keyframes moon_movement {
0% {
transform: translate(-200%, 0);
opacity: 0
}
49.99% {
transform: translate(0%, 0);
opacity: 1
}
99.99% {
transform: translate(200%, 0);
opacity: 0
}
100% {
transform: translate(-200%, 0);
opacity: 1
}
}
/*custom*/
#arlinapuasa2018 {
display: block;
background: #fff;
position: fixed;
top: 25%;
right: 0;
left: 0;
margin: auto;
text-align: center;
max-width: 660px;
box-shadow: 0 19px 38px rgba(0, 0, 0, 0.1), 0 15px 12px rgba(0, 0, 0, 0.12);
z-index: 99;
min-height: 350px;
padding: 20px;
overflow: hidden;
border-radius: 10px;
animation: change_color 7s infinite linear, flipInX 1s linear
}
#arlinapuasa2018 .puasa18 {
position: absolute;
color: #fff;
font-size: 2rem;
font-weight: 400;
padding: 30px;
z-index: 99999;
text-align: center;
margin: auto;
left: 0;
right: 0;
top: 20%
}
#arlinapuasa2018 .puasa18 p {
margin: 20px auto 20px;
text-shadow: 2px 2px 5px rgba(0, 0, 0, 0.2)
}
#arlinapuasa2018 .puasa18 .ramadan2018 {
font-size: 3rem;
font-weight: 700
}
#arlinapuasa2018 a.close-popup {
position: absolute;
bottom: 1px;
right: 1px;
color: #fff;
text-align: center;
border-radius: 100%;
cursor: pointer;
z-index: 999999;
transition: all .3s
}
#arlinapuasa2018 a.close-popup:hover {
color: #fff
}
#arlinapuasa2018 a.close-popup:active {
opacity: 0
}
#arlinapuasa2018 a.close-popup i {
font-family: fontawesome;
font-size: 20px;
font-weight: normal;
font-style: normal;
transform: rotate(270deg);
transition: all .3s
}
#arlinapuasa2018 a.close-popup:hover i {
transform: rotate(360deg)
}
.gunung18 {
width: 400px;
height: 300px;
display: block;
background: #4aad52;
position: absolute;
bottom: -150px;
transform: rotate(45deg);
border-radius: 50px;
z-index: 2;
left: 0;
}
.gunung18.behind {
background: #42a54a;
right: -120px;
bottom: -180px;
z-index: 1
}
.hari18 {
width: 100%;
height: 100%;
display: block;
position: absolute;
top: 0;
left: 0;
animation: run_hari18 7s infinite linear
}
.hari18 .awan18 {
margin: 30px auto;
width: 150px;
height: 70px;
display: block;
background: #e7e7e7;
border-radius: 35px;
border: 10px solid #ffffff;
box-shadow: inset 0 -7px 0 0 #d7d7d7;
position: absolute;
top: 90px;
left: 50px
}
.hari18 .awan18:before {
content: ''', ''';
width: 65px;
height: 35px;
display: block;
background: #e7e7e7;
border-radius: 35px 35px 0 0;
border: 10px solid #ffffff;
border-bottom: 0;
position: absolute;
top: -35px;
left: 20px
}
.hari18 .awan18.invert {
top: 60px;
left: 250px
}
.hari18 .awan18.invert:before {
left: 50px
}
.hari18 .sun {
width: 75px;
height: 75px;
display: block;
background: #fff297;
border-radius: 50%;
box-shadow: inset -5px -5px 0 0 #ddc991;
position: absolute;
top: 50px;
left: 0;
animation: sun_movement 7s infinite linear
}
.malam18 {
width: 100%;
height: 100%;
display: block;
position: absolute;
top: 0;
left: 0;
animation: run_malam18 7s infinite linear
}
.malam18 .bintang18 .star {
width: 5px;
height: 5px;
display: block;
background: #f7f7f7;
border-radius: 50%;
position: absolute
}
.malam18 .bintang18 .star:nth-child(1) {
top: 50px;
left: 50px
}
.malam18 .bintang18 .star:nth-child(2) {
top: 200px;
left: 70px
}
.malam18 .bintang18 .star:nth-child(3) {
top: 100px;
left: 300px
}
.malam18 .bintang18 .star:nth-child(4) {
top: 50px;
left: 220px
}
.malam18 .bintang18 .star:nth-child(5) {
top: 160px;
left: 320px
}
.malam18 .bintang18 .star:nth-child(6) {
top: 150px;
left: 230px
}
.malam18 .bintang18 .star:nth-child(7) {
top: 180px;
left: 400px
}
.malam18 .bintang18 .star:nth-child(8) {
top: 50px;
left: 360px
}
.malam18 .moon {
width: 75px;
height: 75px;
display: block;
background: #d7d7d7;
border-radius: 50%;
box-shadow: inset -5px -5px 0 0 #c7c7c7;
position: absolute;
top: 50px;
left: 100px;
animation: moon_movement 7s infinite linear
}
<script type="text/javascript" src="https://code.jquery.com/jquery-3.6.0.js"></script>
<link rel="stylesheet" href="css.css">
<!-- Start Ramdan -->
<div id='arlinapuasa2018'>
<div class="overflow-hid">
<div class='puasa18'>
<p>كل عام والأمة الأسلامية بخير</p>
<p><span class='ramadan2018'>رمضان كريم</span></p>
</div>
<div class='gunung18'></div>
<div class='gunung18 behind'></div>
<div class='hari18'>
<div class='awan18'></div>
<div class='awan18 invert'></div>
<div class='sun'></div>
</div>
<div class='malam18'>
<div class='bintang18'>
<div class='star'></div>
<div class='star'></div>
<div class='star'></div>
<div class='star'></div>
<div class='star'></div>
<div class='star'></div>
<div class='star'></div>
<div class='star'></div>
</div>
<div class='moon'></div>
</div>
</div>
<a class='close-popup' href='#' title='close'><i class='fa fa-times'></i></a>
</div>
<!-- End Ramdan -->
<!-- ramdan js -->
<script type='text/javascript'>
//<![CDATA[
// Ramadan
jQuery(function($) {
$(window).bind("load",function(){
$("#arlinapuasa2018").animate({top:"15%"},1e3),
$("a.close-popup").click(function(){
return $(this).parent().fadeOut(2e3),!2;
})
});
});
</script>
I hope someone here can help me with that .
I just want to be able to cloes tap In this design
You can add
$("#close-popup").click(function() {
$("#arlinapuasa2018").remove();
})
to your code.
and if you don't see the X check if your fontawesome tag works or just replace:
<a class='close-popup' href='#' title='close'><i class='fa fa-times'></i></a>`
with
<a class='close-popup' href='#' title='close'>X</a>`
Or add z-index: 1000; on #close-popup to put in the foreground.
I am having an issue where my animating arrow is going outside of my div when the height is set to auto. Is there any way to prevent the arrow from going outside of the div, while maintaining the height as auto (for responsive purposes)? Any help would be much appreciated.
When I set the height to a fixed height, for example: 300px, the animating arrow completely disappears when it comes to responsiveness; hence, I want to keep the height as auto, while preventing it from going outside of the div.
.title-container-main {
margin-top: 40px;
margin-left: auto;
margin-right: auto;
position: relative;
width: 83%;
height: auto;
background-color: green;
overflow: auto;
}
.title-main{
margin-top: 0px;
padding-top: 12px;
text-align: center;
font-family: myFirstFont;
font-size: 36px;
font-weight: lighter;
color: #7f1146;
letter-spacing: 3.5px;
margin-bottom: 40px;
background-color: white;
}
.title-main::after {
display: block;
content: '';
background-color: #7f1146;
height: 1.5px;
width: 8%;
margin: 13px auto 0 auto;
}
.title-container-text{
line-height: 1.5em;
width: 80%;
margin-left: auto;
margin-right: auto;
text-align: center;
font-weight: bold;
color: #674965;
position: relative;
font-family: mySecondFont;
font-size: 18px;
text-transform: none;
background-color: white;
}
a.active:after {
display: block;
content: '';
background-color: white;
height: 1.5px;
width: 100%;
margin: 2px auto 0 auto;
}
.scroll-down {
margin-left: auto;
margin-right: auto;
margin-top: 45px;
position: relative;
display: block;
text-align: center;
font-size: 20px;
z-index: 100;
text-decoration: none;
text-shadow: 0;
width: 25px;
height: 25px;
border-bottom: 2px solid #7f1146;
border-right: 2px solid #7f1146;
z-index: 9;
-webkit-transform: translate(-50%, 0%) rotate(45deg);
-moz-transform: translate(-50%, 0%) rotate(45deg);
transform: translate(-50%, 0%) rotate(45deg);
-webkit-animation: fade_move_down 4s ease-in-out infinite;
-moz-animation: fade_move_down 4s ease-in-out infinite;
animation: fade_move_down 4s ease-in-out infinite;
}
/*animated scroll arrow animation*/
#-webkit-keyframes fade_move_down {
0% { -webkit-transform:translate(0,-10px) rotate(45deg); opacity: 0; }
50% { opacity: 1; }
100% { -webkit-transform:translate(0,10px) rotate(45deg); opacity: 0; }
}
#-moz-keyframes fade_move_down {
0% { -moz-transform:translate(0,-10px) rotate(45deg); opacity: 0; }
50% { opacity: 1; }
100% { -moz-transform:translate(0,10px) rotate(45deg); opacity: 0; }
}
#keyframes fade_move_down {
0% { transform:translate(0,-10px) rotate(45deg); opacity: 0; }
50% { opacity: 1; }
100% { transform:translate(0,10px) rotate(45deg); opacity: 0; }
}
<div class="title-container-main">
<h2 class="title-main">TREATMENTS</h2>
<p class="title-container-text">Some text.
<div class="scroll-down"></div>
</div>
I suggest you use the .scroll-down container as a placeholder and you set the dimensions. The width can be 100% and the height needed is easily calculated:
element_height (25px) + translation_top (10px) + translation_bot (10px) = 45px
In addition, you can use a pseudo-element (e.g. :after) to draw the arrow. We can use absolute positioning, therefore, it will not interfere with the height:
.title-container-main {
margin-top: 40px;
margin-left: auto;
margin-right: auto;
width: 83%;
height: auto;
background-color: green;
overflow: auto;
text-align: center;
z-index: 1;
}
.title-main {
margin-top: 0px;
padding-top: 12px;
text-align: center;
font-family: myFirstFont;
font-size: 36px;
font-weight: lighter;
color: #7f1146;
letter-spacing: 3.5px;
margin-bottom: 40px;
background-color: white;
}
.title-main::after {
display: block;
content: '';
background-color: #7f1146;
height: 1.5px;
width: 8%;
margin: 13px auto 0 auto;
}
.title-container-text {
line-height: 1.5em;
width: 80%;
margin-left: auto;
margin-right: auto;
text-align: center;
font-weight: bold;
color: #674965;
position: relative;
font-family: mySecondFont;
font-size: 18px;
text-transform: none;
background-color: white;
}
a.active:after {
display: block;
content: '';
background-color: white;
height: 1.5px;
width: 100%;
margin: 2px auto 0 auto;
}
.scroll-down {
position: relative;
width: 100%;
height: 45px;
z-index: 1;
}
.scroll-down:after {
position: absolute;
content: '';
font-size: 20px;
z-index: -1;
text-decoration: none;
text-shadow: 0;
width: 25px;
height: 25px;
margin-left: -14px;
border-bottom: 2px solid #7f1146;
border-right: 2px solid #7f1146;
-webkit-transform: translate(0%, 0%) rotate(45deg);
-moz-transform: translate(0%, 0%) rotate(45deg);
transform: translate(0%, 0%) rotate(45deg);
-webkit-animation: fade_move_down 4s ease-in-out infinite;
-moz-animation: fade_move_down 4s ease-in-out infinite;
animation: fade_move_down 4s ease-in-out infinite;
}
/*animated scroll arrow animation*/
#-webkit-keyframes fade_move_down {
0% {
-webkit-transform: translate(0, -10px) rotate(45deg);
opacity: 0;
}
50% {
opacity: 1;
}
100% {
-webkit-transform: translate(0, 10px) rotate(45deg);
opacity: 0;
}
}
#-moz-keyframes fade_move_down {
0% {
-moz-transform: translate(0, -10px) rotate(45deg);
opacity: 0;
}
50% {
opacity: 1;
}
100% {
-moz-transform: translate(0, 10px) rotate(45deg);
opacity: 0;
}
}
#keyframes fade_move_down {
0% {
transform: translate(0, -10px) rotate(45deg);
opacity: 0;
}
50% {
opacity: 1;
}
100% {
transform: translate(0, 10px) rotate(45deg);
opacity: 0;
}
}
<div class="title-container-main">
<h2 class="title-main">TREATMENTS</h2>
<p class="title-container-text">Some text.</p>
<div class="scroll-down"></div>
</div>
I have a heading text and a button below it. When I hover on button, the text into the heading and the button is shaking. I fixed it with the css property backface-visibility and then the text into the elements was blurred. How to solve this problem without the blurry effect ?
e.g. https://codepen.io/yozhikk/pen/odJVeY
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: sans-serif;
font-weight: 400;
font-size: 16px;
line-height: 1.7;
color: #777777;
padding: 30px;
}
.header {
position: relative;
height: 95vh;
background-image: linear-gradient( to right bottom, rgba(126, 213, 111, 0.8), rgba(40, 180, 131, 0.8)), url(../img/hero.jpg);
background-size: cover;
background-position: top;
clip-path: polygon( 0% 0%, 0% 100%, 100% 75vh, 100% 0%)
}
.logo-box {
position: absolute;
top: 40px;
left: 40px;
}
.logo {
height: 35px;
}
.heading-primary {
color: #ffffff;
text-transform: uppercase;
margin-bottom: 60px;
-webkit-backface-visibility: hidden;
-webkit-transform: translateZ(0) scale(1.0, 1.0);
}
.heading-primary-main {
font-weight: 400;
font-size: 60px;
letter-spacing: 35px;
display: block;
animation: moveInLeft 1.5s ease-out
}
.heading-primary-sub {
font-weight: 700;
font-size: 20px;
letter-spacing: 17.4px;
display: block;
animation: moveInRight 1.5s ease-out
}
.text-box {
position: absolute;
top: 40%;
left: 50%;
transform: translate(-50%, -50%);
text-align: center;
}
.btn:link,
.btn:visited {
text-decoration: none;
text-transform: uppercase;
display: inline-block;
border-radius: 100px;
padding: 15px 40px;
transition: all .2s;
-webkit-backface-visibility: hidden;
-webkit-transform: translateZ(0) scale(1.0, 1.0);
}
.btn:hover {
transform: translateY(-3px);
}
.btn:active {
transform: translateY(-1px);
}
.btn {}
.btn-white {
background-color: #fff;
color: #777777;
}
#keyframes moveInLeft {
0% {
opacity: 0;
transform: translateX(-100px)
}
80% {
transform: translateX(10px)
}
100% {
opacity: 1;
transform: translate(0)
}
}
#keyframes moveInRight {
0% {
opacity: 0;
transform: translateX(100px)
}
80% {
transform: translateX(-10px)
}
100% {
opacity: 1;
transform: translate(0)
}
}
<header class="header">
<div class="logo-box">
<img src="img/logo-white.png" alt="" class="logo">
</div>
<div class="text-box">
<h1 class="heading-primary">
<span class="heading-primary-main">outdoors</span>
<span class="heading-primary-sub">is where live happens</span>
</h1>
Discover our tours
</div>
Remove these lines:
.btn:hover {
transform: translateY(-3px);
}
.btn:active {
transform: translateY(-1px);
}
They move the button up on hover / active for no apparent reason, which I assume is the shaking you are talking about. So just not doing that should fix it.
Give the same property you added to the hover state to the initial state but make it invisible. If you give the hover state (border : 2px solid and pink;) add it in the initial state but you can make the color transparent( border: 3px solid transparent;) so it won't show before hovering on it
Helo Guys!
I was trying to create a spinning hover effect with CSS3.
Just made a circle spinning effect. Check the jsFiddle here: http://jsfiddle.net/63yyeezn/26/
However what I want to do now is to create something tthat spins but this time its box type
just like this image:
So basically I want similar effect just like the jsFiddle I shown above however this time it must be box.
Really having a hard time figuring this out. Here's my CSS:
body {
background: #292929;
padding-left: 30px;
font-size: 12px;
}
.twist {
display: inline-block;
font-size: 45px;
line-height: 90px;
cursor: pointer;
margin: 20px;
width: 90px;
height: 90px;
border-radius: 50%;
text-align: center;
position: relative;
text-decoration: none;
z-index: 1;
color: #fff;
}
.twist:after {
pointer-events: none;
position: absolute;
width: 100%;
height: 100%;
border-radius: 50%;
content:'';
-webkit-box-sizing: content-box;
-moz-box-sizing: content-box;
box-sizing: content-box;
}
.twist:before {
speak: none;
font-size: 48px;
line-height: 90px;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
display: block;
-webkit-font-smoothing: antialiased;
}
.twist.demo-4 {
width: 92px;
height: 92px;
box-shadow: 0 0 0 4px rgba(255, 255, 255, 1);
}
.twist.demo-4:before {
line-height: 92px;
}
.twist.demo-4:after {
top: -4px;
left: -4px;
padding: 0;
z-index: 10;
border: 4px dashed #fff;
}
.twist.demo-4:hover {
box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
color: #fff;
}
.twist.demo-4:hover i {
color: #fff;
}
.twist.demo-4.spin:hover {
-webkit-transition: box-shadow 0.2s;
-moz-transition: box-shadow 0.2s;
transition: box-shadow 0.2s;
}
.twist.demo-4.spin:hover:after {
-webkit-animation: spinAround 9s linear infinite;
-moz-animation: spinAround 9s linear infinite;
animation: spinAround 9s linear infinite;
}
#-webkit-keyframes spinAround {
from {
-webkit-transform: rotate(0deg)
}
to {
-webkit-transform: rotate(360deg);
}
}
#-moz-keyframes spinAround {
from {
-moz-transform: rotate(0deg)
}
to {
-moz-transform: rotate(360deg);
}
}
#keyframes spinAround {
from {
transform: rotate(0deg)
}
to {
transform: rotate(360deg);
}
}
Hope you can help me with a jsFiddle file.
Thanks!
My answer won't fit exactly your example, but may interest you as it's a full-CSS3 solution, without HTML markup change. The animation won't be a rotation, but a translation.
Webkit version
.bordered {
overflow: hidden;
}
.bordered:before {
content: '';
position: absolute;
top: 5px; /* 5px: border width */
left: 5px;
right: 5px;
bottom: 5px;
background: white;
z-index: -1;
}
.bordered:after {
content: '';
position: absolute;
top: -50%;
left: -50%;
right: -50%;
bottom: -50%;
background: black;
z-index: -2;
}
.bordered:hover:after {
background: -webkit-linear-gradient(left, white 50%, black 50%); /* black: border color*/
background-size: 20px 100%; /* 20px: dash width */
-webkit-animation: borderAnimated 1s linear infinite;
}
#-webkit-keyframes borderAnimated {
from {
transform: rotate(45deg) translate(0, 0);
}
to {
transform: rotate(45deg) translate(20px, 0);
}
}
/* --- Style only--- */
.bordered {
width: 150px;
height: 150px;
line-height: 150px;
text-align: center;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
<div class="bordered">Lorem ipsum</div>
The trick is to have a stripped background in the :after pseudo-element, and a fake empty background in the :before element, which will work as a mask. When hovering your element, you just have to animate the :after pseudo-element to get something nice.
Credits: #vsynz
I don't think it can be possible only with static borders. Here is an alternative solution:
.rotating-dashed {
position: relative;
margin: 40px auto;
width: 90px;
height: 90px;
overflow: hidden;
color: #268;
}
.rotating-dashed .dashing {
display: block;
width: 100%;
height: 100%;
position: absolute;
}
.rotating-dashed .dashing:nth-of-type(2) {
-webkit-transform: rotate(90deg);
}
.rotating-dashed .dashing:nth-of-type(3) {
-webkit-transform: rotate(180deg);
}
.rotating-dashed .dashing:nth-of-type(4) {
-webkit-transform: rotate(270deg);
}
.rotating-dashed .dashing i {
display: block;
position: absolute;
left: 0;
top: 0;
width: 200%;
border-bottom: 5px solid
}
.rotating-dashed strong {
display: block;
width: 105%;
line-height: 90px;
text-align: center;
position: absolute;
}
.rotating-dashed:hover {
cursor: pointer;
}
.rotating-dashed:hover .dashing i {
-webkit-animation: slideDash 2.5s infinite linear;
border-bottom: 5px dashed
}
#-webkit-keyframes slideDash {
from {
-webkit-transform: translateX(-50%);
}
to {
-webkit-transform: translateX(0%);
}
}
<div class="rotating-dashed"> <span class="dashing"><i></i></span>
<span class="dashing"><i></i></span>
<span class="dashing"><i></i></span>
<span class="dashing"><i></i></span>
<strong>Demo</strong>
</div>