Font size rem doesn't scale on different screen - html

Fonts and elements don't scale when the screen size is reduced. Following is the code. In the developer tools if I change the root HTML font size, the font's and respective elements scale but when the screen size is reduced it doesn't.
/*
COLORS:
Light green: #7ed56f
Medium green: #55c57a
Dark green: #28b485
font-grey: #777777
*/
* *::after,
*::before {
margin: 0;
padding: 0;
box-sizing: inherit;
}
html {
font-size: 62.5%;
}
body {
font-family: "Lato", sans-serif;
font-weight: 400;
line-height: 1.7;
color: #777777;
padding: 3rem;
box-sizing: border-box;
}
.header {
height: 95vh;
/*95% of screen*/
background-image: linear-gradient( to right bottom, rgba(126, 213, 111, 0.8), rgba(23, 133, 96, 0.8)), url(../img/hero.jpg);
background-size: cover;
/*image adapts to the screen*/
background-position: top;
/* top of the image stays the same whatever the screen size*/
clip-path: polygon(0 0, 100% 0, 100% 70vh, 0 100%);
position: relative;
}
.logo-box {
position: absolute;
top: 4rem;
left: 4rem;
}
.logo {
height: 3.5rem;
}
.text-box {
position: absolute;
top: 40%;
left: 50%;
transform: translate(-50%, -50%);
text-align: center;
}
.heading-primary {
color: #ffffff;
text-transform: uppercase;
backface-visibility: hidden;
/*part behind the element gets hidden*/
margin-bottom: 4rem;
}
.heading-primary-main {
display: block;
font-size: 6rem;
font-weight: 400;
letter-spacing: 3.5rem;
animation-name: left;
animation-duration: 1s;
animation-timing-function: ease-out;
/* animation-iteration-count: 2;
animation-delay: 2; */
}
.heading-primary-sub {
display: block;
font-size: 2rem;
font-weight: 700;
letter-spacing: 2.1rem;
animation: left 1s ease-out;
}
#keyframes right {
from {
opacity: 0;
transform: translateX(10rem);
}
80% {
transform: translateX(-1rem);
}
to {
opacity: 1;
transform: translate(0);
}
}
#keyframes left {
from {
opacity: 0;
transform: translateX(-10rem);
}
80% {
transform: translateX(1rem);
}
to {
opacity: 1;
transform: translate(0);
}
}
#keyframes button {
from {
opacity: 0;
transform: translateY(2rem);
}
to {
opacity: 1;
transform: translate(0);
}
}
.btn-animated {
animation: button 0.5s ease-out 0.75s;
animation-fill-mode: backwards;
}
.btn:link,
.btn:visited {
text-decoration: none;
text-transform: uppercase;
padding: 1.5rem 4rem;
display: inline-block;
border-radius: 10rem;
transition: all 0.5s;
position: relative;
font-size: 1.6rem;
}
.btn:hover {
transform: translateY(-3px);
box-shadow: 0 1rem 2rem rgba(0, 0, 0, 0.5);
/* x-axis y-axis blur color */
}
.btn:active {
transform: translateY(-1px);
box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.8);
}
.btn-white {
background-color: #fff;
color: #777777;
}
.btn::after {
content: "";
display: inline-block;
height: 100%;
width: 100%;
border-radius: 10rem;
position: absolute;
top: 0;
left: 0;
z-index: -1;
transition: all 0.4s;
}
.btn-white::after {
background-color: #fff;
}
.btn:hover::after {
transform: scaleX(1.2) scaleY(1.4);
opacity: 0;
}
<link href="https://fonts.googleapis.com/css?family=Lato:100,300,400,700,900" rel="stylesheet">
<header class="header">
<div class="logo-box">
<img src="img/logo-white.png" alt="Logo Natours" class="logo">
</div>
<div class="text-box">
<h1 class="heading-primary">
<span class="heading-primary-main">Outdoors</span>
<span class="heading-primary-sub">Where life happens</span>
</h1>
Discover Our Tours
</div>
</header>
<div>
</div>

CSS doesn't work like that. You need media queries in order to set different font sizes based on screen width.
I.e. you need to tell your browser that when the screen is some width or wider (or smaller), change the font size to Y.
This is for when you want the font size to work for everything above 601px
#media screen and (min-width: 601px) {
div.example {
font-size: 80px;
}
}
This is for when you want the font size to work for everything below 601px
#media screen and (min-width: 601px) {
div.example {
font-size: 80px;
}
}

Related

CSS Animation: fade out and translate text and fade back in but with larger font size

Is it possible to create an animation with CSS so that a given element (in the example, an h2 tag) when hovered moves a bit and fades out, and come back a few moments later fading in with a larger font-size.
Ideally:
This would occur on hover and the inverse when no longer hovering.
Without specifying the initial font size (in the example 2rem).
I've been trying some solutions with animations but so far nothing close to what I'm looking for.
Thanks
Edit: added short animation of what I was looking for (line is there for geometric reference of the text's position):
Edit2: the GIF if looping, but the text is supposed to remain large while the container element is hovered.
:root {
height: 100%;
background-color: lightgrey;
padding: 30px;
text-align: center;
}
h2 {
font-family: Arial;
font-size: 2rem;
}
:root:hover h2 {
font-size: 5rem;
animation: text 1s forwards ease-out;
}
#keyframes text {
0% {
transform: translateY(-30px);
opacity: 1;
}
50% {
opacity: 0;
}
100% {
}
}
<h2>TEXT</<h2>
Thank you for providing a snippet. Not sure this is what you opted for. I added a flex container to center the text, but this is optional.
:root {
height: 100%;
background-color: lightgrey;
padding: 30px;
text-align: center;
}
h2 {
font-family: Arial;
}
:root:hover h2 {
animation: text 1s forwards ease-out;
}
#keyframes text {
0% {
transform: translateY(0px);
opacity: 1;
}
25% {
transform: translateY(-30px);
opacity: 0;
font-size: 1rem;
}
50% {
opacity: 0;
}
75% {
opacity: 0;
transform: translateY(0px);
}
100% {
font-size: 5rem;
opacity: 1;
}
}
<div style="height: 150px; display:flex; align-items: center; justify-content: center;">
<h2>TEXT</h2>
</div>
UPDATE: Attempting doing the gif animation
:root {
height: 100%;
background-color: lightgrey;
padding: 30px;
text-align: center;
}
h2 {
font-family: Arial;
font-size: 2em;
margin-bottom: 0;
line-height: 1;
position: absolute;
bottom: 0;
text-align: center;
width: 100%
}
:root:hover h2 {
animation: text 1s forwards ease-out;
}
#keyframes text {
0% {
transform: translateY(0px);
opacity: 1;
}
25% {
transform: translateY(+50px);
opacity: 0;
}
50% {
opacity: 0;
font-size: 2em;
}
75% {
opacity: 0;
font-size: 5em;
transform: translateY(+50px);
}
100% {
font-size: 5rem;
transform: translateY(0px);
opacity: 1;
}
}
<div style="height: 100px; position: relative; border: 1px solid red;">
<h2>TEXT</h2>
</div>
<hr>
The root element confuses me. Nevertheless, you can add a font-size and oppacity 0 at 50 percent. The element will return to the original place afterwards. The margin-top keeps the element with the bigger font size in place. Not sure if this is the ideal solution.
Maybe just personal preference. I have changed the animation to ease-in-out, see https://www.w3schools.com/css/css3_transitions.asp
:root {
height: 100%;
background-color: lightgrey;
text-align: center;
}
h2 {
font-family: Arial;
padding: 0px;
}
:root:hover h2 {
animation: text 3s forwards ease-in-out;
}
#keyframes text {
0% {
opacity: 1;
}
50% {
opacity: 0;
font-size: 2rem;
}
100% {
opacity: 1;
margin-top: 1.5rem;
font-size: 3.5rem;
}
}
<h2>TEXT</<h2>

Strange not wanted behavior of a button in HTML and CSS

I'm having trouble with a button. It's a text with a background color and some padding. Basically, when I refresh the page, the button takes a bit less than a second before getting to its dimension. It starts with 0 paddings and gets to the value I set after a few moments like it was animated, but it wasn't. I didn't set any animation for it to do it. I'll leave the code here
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: "Lato", sans-serif;
font-weight: 400;
font-size: 16px;
line-height: 1.7;
color: #777;
padding: 30px;
}
.header {
height: 95vh;
background-image: linear-gradient(
to right bottom,
rgba(126, 213, 111, 0.8),
rgba(40, 180, 133, 0.80)),
url(../img/hero.jpg);
background-size: cover;
background-position: top;
position: relative;
clip-path: polygon(0 0, 100% 0, 100% 75vh, 0 100%);
}
.logo-box {
position: absolute;
top: 40px;
left: 40px;
}
.logo {
height: 35px;
}
.text-box {
position: absolute;
top: 40%;
left: 50%;
transform: translate(-50%, -50%);
text-align: center;
}
.heading-primary {
color: #fff;
text-transform: uppercase;
margin-bottom: 60px;
}
.heading-primary-main {
display: block;
font-size: 60px;
font-weight: 400;
letter-spacing: 35px;
animation: moveInLeft 1s ease-out;
/*animation-delay: 3s;*/
/*animation-iteration-count: 3;*/
}
.heading-primary-sub {
display: block;
font-size: 20px;
font-weight: 700;
letter-spacing: 17.4px;
animation: moveInRight 1s ease-out;
}
#keyframes moveInLeft {
0% {
opacity: 0;
transform: translateX(-100px);
}
100% {
opacity: 1;
transform: translate(0);
}
}
#keyframes moveInRight {
0% {
opacity: 0;
transform: translateX(100px);
}
100% {
opacity: 1;
transform: translate(0);
}
}
.btn:link,
.btn:visited {
text-transform: uppercase;
text-decoration: none;
padding: 15px 40px;
display: inline-block;
border-radius: 100px;
transition: transform, box-shadow, .2s;
position: relative;
animation: moveInBottom 1s ease-out;
}
.btn:hover {
transform: translateY(-3px);
box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}
.btn:active {
transform: translateY(-1px);
box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
}
.btn-white {
background-color: #fff;
color: #777;
}
.btn::after {
content: "";
display: inline-block;
height: 100%;
width: 100%;
border-radius: 100px;
position: absolute;
top: 0;
left: 0;
z-index: -1;
transition: tansform, opacity, .4s;
}
.btn-white::after {
background-color: #fff;
}
.btn:hover::after {
transform: scaleX(1.4) scaleY(1.6);
opacity: 0;
}
#keyframes moveInBottom {
0% {
opacity: 0;
transform: translateY(50px);
}
100% {
opacity: 1;
transform: translate(0);
}
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="https://fonts.googleapis.com/css?family=Lato:100,300,400,700,900" rel="stylesheet">
<link rel="stylesheet" href="css/icon-font.css">
<link rel="stylesheet" href="css/style.css">
<link rel="shortcut icon" type="image/png" href="img/favicon.png">
<title>Natours | Exciting tours for adventurous people</title>
</head>
<body>
<header class="header">
<div class="logo-box">
<img src="img/logo-white.png" alt="Logo" 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 life happens</span>
</h1>
Discover our tours
</div>
</header>
</body>
</html>
This thing happens in chrome but not in firefox. I'm following a course on a very well known website and, despite the guy does exactly the same code, it doesn't seem that he has the same problem.
Thank you guys, I really appreciate what you do every day, helping us solve our problems.
Happy new year, btw
Change transition it into
transition: transform .2s, box-shadow .2s; and transition: transform .4s, opacity .4s;
This is the way to use multiple properties in transition.
transition: transform, box-shadow, .2s; this will be equivalent to
transition-property: transform, box-shadow, all;
transition-duration: 0s, 0s, 0.2s;

When I hover on element it's shaking. How fix?

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

Div with Upward Scroll fixed in Centre

Im struggling a bit with this project that I am working on. Essentially I have a chat interface built in angular, im having a problem getting the CSS styling right. At the moment the chat starts at the top, then scrolls down off the screen as the conversation grows. I can scroll with the conversation but this isnt very good UX.
I am trying to make it so the 'Send Message' box starts in the bottom third of the screen and is fixed. Then, as the conversation grows, the messages move upwards/away instead of downwards. Ideally I want this in a container that disappears (behind a header, etc).
I've been trying to wrap my brain around this for the past few days with not much luck. CSS isnt really a strong point of mine. Any help would be greatly appreciated
CSS & Image of current setup below (there is also a separate styling sheet but this is only for the button/message stylings:
<body><style>
body { background: #FFFFFF; color: #727272; }
h1, h2, h3, h4, { background: #FFFFFF; color: #212121; } body { background: #FFFFFF; color: #727272; }
html, body, form, strong, button, small, input, p, div, h1, h2, h3, h4
{ outline: 0; margin: 0; padding: 0; border: 0; font-family: "Helvetica Neue",Helvetica,Arial,sans-serif; line-height: 1.4em; font-size: 100%; } !important;
a, a:active
{ color: #F8F8F8; text-decoration: none; }
a:hover { text-decoration: underline; }
button,
a { cursor: pointer; } strong { font-weight: 500; }
p, h1, h2, h3, h4 { margin-top: 1em; margin-bottom: 1em; }
h1, h2, h3, h4 { font-weight: 200; font-size: 32px; }
html, body, p, div { font-weight: 200; font-size: 17px; } .clear { clear: both }
.container { padding-right: 7vw; padding-left: 7vw; margin-right: auto; margin-left: auto; height: 100vh; }
</style><style>
/* .header { overflow: hidden; position: relative; min-height: 100vh; padding-bottom: 0vh; text-align: center; color: #F8F8F8; background: linear-gradient( to left, rgba(122,214,184,0.0) 0%, rgba(122,214,184,0.7) 100% ), linear-gradient( to bottom, rgb(60,240,80) 0%, rgb(122,214,184) 100% ); } */
.header { overflow: hidden; position: relative; min-height: 100vh; padding-bottom: 0vh; text-align: center; color: #F8F8F8; background: linear-gradient( to left, rgba(204,52,148,0.0) 0%, rgba(239,45,86,0.7) 100% ), linear-gradient( to bottom, rgb(204,52,148) 0%, rgb(204,52,148) 100% ); }
input::-webkit-input-placeholder { color: rgba(200,255,255,0.5) !important; } .header .signup { margin-top: 4em; } .header
input { background: transparent; color: #F8F8F8; border: 0; border-bottom: 1px solid rgba(255,255,255,0.8); line-height: 2em; font-size: 1.4em; text-align: center; width: 12em; }
/* .angularjs-chat-bubble-white { position: absolute; display: inline-block; background: transparent url(https://i.imgur.com/3Sdc2xD.png); background-size: 100%; background-repeat: no-repeat; } */
.bothello-bubble { position: absolute; display: inline-block; background: transparent url(https://i.imgur.com/kN9kf2o.png); background-size: 100%; background-repeat: no-repeat; }
.header .bubble-one { top: 15vh; left: 10vw; width: 30px; height: 30px; opacity: 0.1; transform-origin: 70% 400%; animation: bubble-move 3s ease-in-out 0s infinite alternate; }
.header .bubble-two { top: 44vh; left: 6vw; width: 100px; height: 100px; opacity: 0.1; transform-origin: 60% 400%; animation: bubble-move 4s ease-in-out 0s infinite alternate; }
.header .bubble-three { top: 75vh; left: 22vw; width: 20px; height: 20px; opacity: 0.2; transform-origin: 30% 120%; animation: bubble-move 2s ease-in-out 0s infinite alternate; }
.header .bubble-four { top: 14vh; left: 28vw; width: 15px; height: 15px; opacity: 0.1; transform-origin: 20% 400%; animation: bubble-move 2s ease-in-out 0s infinite alternate; }
.header .bubble-five { top: 30vh; left: 66vw; width: 14px; height: 14px; opacity: 0.2; transform-origin: 90% 100%; animation: bubble-move 5s ease-in-out 0s infinite alternate; }
.header .bubble-six { top: 8vh; left: 75vw; width: 23px; height: 23px; opacity: 0.2; transform-origin: 80% 200%; animation: bubble-move 2s ease-in-out 0s infinite alternate; }
.header .bubble-seven { top: 33vh; left: 84vw; width: 120px; height: 120px; opacity: 0.2; transform-origin: 100% 90%; animation: bubble-move 6s ease-in-out 0s infinite alternate; }
.header .bubble-eight { top: 72vh; left: 85vw; width: 360px; height: 360px; opacity: 0.2; transform-origin: -100% 100%; animation: bubble-move 7s ease-in-out 0s infinite alternate; }
/* .messagebox { padding-top: 90vh; position: fixed;} */
#keyframes bubble-move { 0% { opacity: 0.6; transform: scale(1.0) rotate(-8deg) translate(-1px,-2px); } 70% { opacity: 0.3; transform: scale(1.04) rotate(10deg) translate(2px,1px); } 100% { opacity: 0.4;
transform: scale(0.94) rotate(-18deg) translate(-3px,-1px); } }
</style>
<div class="header">
<!-- <div class="container"> -->
<div class="bothello-bubble bubble-one"></div>
<div class="bothello-bubble bubble-two"></div>
<div class="bothello-bubble bubble-three"></div>
<div class="bothello-bubble bubble-four"></div>
<div class="bothello-bubble bubble-five"></div>
<div class="bothello-bubble bubble-six"></div>
<div class="bothello-bubble bubble-seven"></div>
<div class="bothello-bubble bubble-eight"></div>
<div class="container">
<ng-container *ngFor="let message of messages | async">
<div class="message" [ngClass]="{ 'from': message.sentBy === 'bot',
'to': message.sentBy === 'user' }">
{{ message.content }}
</div>
</ng-container>
<div class="messagebox">
<label for="nameField">Your Message</label>
<input [(ngModel)]="formValue" (keyup.enter)="sendMessage()" type="text">
<button (click)="sendMessage()">Send</button>
</div>
<!-- </div> -->
</div>
</div>
</body>
Thanks so much.
Jay
You're looking for:
.container {
display: flex;
flex-direction: column;
}
.container>ng-container {
flex-grow: 1;
overflow: auto;
}
.container>.messagebox {
flex-shrink: 0;
margin-bottom: 3px;
}
You'll also need a small function to scroll <ng-container> to bottom whenever a message gets added to chat, something along these lines:
function scrollToBottom() {
let elem = document.querySelector('ng-container');
elem.scrollTop = elem.scrollHeight;
}
I don't know for sure what are best practices for manipulating DOM nodes in Angular2 (and above) and if there are any favored techniques over .querySelector.
Also note .querySelector can (and should) be used on any DOM node, so you probably want to use it on your ViewContainer rather than on the entire document.
But, since you haven't posted anything related to the JS part, I can't help you more there.

Background showing between divs

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.