CSS not being applied correctly - html

Still learning, I've tried everything within my knowledge to make this work.
I'm trying to apply the following:
https://codepen.io/tech-lane/pen/XWbqGyx
<div class="codepen" data-height="201" data-theme-id="light" data-default-tab="css,result" data-user="tech-lane" data-slug-hash="XWbqGyx" data-prefill='{"title":"Pure CSS | FadeIn Text with bars | KeyFrames & Scss","tags":[],"head":" <script src=\"https://kit.fontawesome.com/aa09fdd343.js\"></script>\n\n","scripts":[],"stylesheets":[]}'>
<pre data-lang="html"><div class="container">
<div class="box">
<div class="title">
<span class="block"></span>
<h1>Lane Willmore<span></span></h1>
</div>
<!-- here role goes -->
<h4 class="wordCarousel">
<div>
<!-- Use classes 2,3, or 4 to match the number of words -->
<ul class="flip4">
<li>Oh My!</li>
<li>Swoosh</li>
<li>Cool</li>
<li>Awesome</li>
</ul>
</div>
</h4>
</div>
</div>
</pre>
<pre data-lang="scss" >#import url('https://fonts.googleapis.com/css?family=Lato:300,400|Poppins:300,400,800&display=swap');
* {
margin: 0;
padding: 0;
}
body, html {
overflow: hidden;
}
.container {
width: 100%;
height: 100vh;
background: #232323;
display: flex;
justify-content: center;
align-items: center;
.box {
width: 250px;
height: 250px;
position: relative;
display: flex;
justify-content: center;
flex-direction: column;
.title {
width: 100%;
position: relative;
display: flex;
align-items: center;
height: 50px;
.block {
width: 0%;
height: inherit;
background: #ffb510;
position: absolute;
animation: mainBlock 2s cubic-bezier(.74, .06, .4, .92) forwards;
display: flex;
}
h1 {
font-family: 'Poppins';
color: #fff;
font-size: 32px;
-webkit-animation: mainFadeIn 2s forwards;
-o-animation: mainFadeIn 2s forwards;
animation: mainFadeIn 2s forwards;
animation-delay: 1.6s;
opacity: 0;
display: flex;
align-items: baseline;
position: relative;
span {
width:0px;
height: 0px;
-webkit-border-radius: 50%;
-moz-border-radius: 50%;
border-radius: 50%;
background: #ffb510;
-webkit-animation: load 0.6s cubic-bezier(.74, .06, .4, .92) forwards;
animation: popIn 0.8s cubic-bezier(.74, .06, .4, .92) forwards;
animation-delay: 2s;
margin-left: 5px;
margin-top: -10px;
position: absolute;
bottom: 13px;
right: -12px;
}
}
}
.wordCarousel {
font-size: 36px;
font-weight: 100;
color: #939393;
div {
overflow: hidden;
position: relative;
float: left;
height: 45px;
padding-top: 5px;
margin-top: -10px;
li {
font-family: Serif;
color: #ccc;
font-weight: 250;
padding: 0 5px;
height: 45px;
margin-bottom: 45px;
display: block;
}
}
}
}
}
.flip4 { animation: flip4 15s cubic-bezier(1, 1, 0.32, 1.2) infinite; }
#keyframes flip4 {
0% { margin-top: -360px; }
5% { margin-top: -270px; }
25% { margin-top: -270px; }
30% { margin-top: -180px; }
50% { margin-top: -180px; }
55% { margin-top: -90px; }
75% { margin-top: -90px; }
80% { margin-top: 0px; }
99.99% { margin-top: 0px; }
100% { margin-top: -270px; }
}
#keyframes mainBlock {
0% {
width: 0%;
left: 0;
}
50% {
width: 100%;
left: 0;
}
100% {
width: 0;
left: 100%;
}
}
#keyframes secBlock {
0% {
width: 0%;
left: 0;
}
50% {
width: 100%;
left: 0;
}
100% {
width: 0;
left: 100%;
}
}
#keyframes mainFadeIn {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
#keyframes popIn {
0% {
width: 0px;
height: 0px;
background: #e9d856;
border: 0px solid #ddd;
opacity: 0;
}
50% {
width: 10px;
height: 10px;
background: #e9d856;
opacity: 1;
bottom: 45px;
}
65% {
width: 7px;
height: 7px;
bottom: 0px;
width: 15px
}
80% {
width: 10px;
height: 10px;
bottom: 20px
}
100% {
width: 7px;
height: 7px;
background: #e9d856;
border: 0px solid #222;
bottom: 13px;
}
}
#keyframes secFadeIn {
0% {
opacity: 0;
}
100% {
opacity: 0.5;
}
}
footer {
width: 350px;
height: 80px;
background: #ffb510;
position: absolute;
right: 0;
bottom: -80px;
display: flex;
justify-content: center;
align-items: center;
animation: top 0.8s forwards;
animation-delay: 4s;
span {
display: flex;
align-items: center;
justify-content: center;
font-size: 12px;
color: #232323;
font-family: 'Poppins';
i {
margin-right: 25px;
font-size: 22px;
color: #232323;
animation: icon 2s forwards;
animation-delay: 4s;
opacity: 0;
}
}
}
#keyframes top {
0% {
opacity: 0;
bottom: -80px
}
100% {
opacity: 1;
bottom: 0px
}
}
#keyframes icon {
0% {
opacity: 0;
transform: scale(0.0);
}
50% {
opacity: 1;
transform: scale(1.3) rotate(-02deg);
}
100% {
opacity: 1;
bottom: 0px;
}
}</pre>
</div>
<script async src="https://static.codepen.io/assets/embed/ei.js"></script>
to my header in the layout found here:
https://www.w3schools.com/howto/tryit.asp?filename=tryhow_make_a_website
When applying it the CSS doesn't style it correctly. I'm hoping someone here can point me in the right direction.

Try this code:
<!DOCTYPE html>
<html lang="en">
<head>
<title>Page Title</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
* {
box-sizing: border-box;
}
/* Style the body */
body {
font-family: Arial, Helvetica, sans-serif;
margin: 0;
}
/* Header/logo Title */
.header {
padding: 80px;
text-align: center;
background: #1abc9c;
color: white;
}
/* Increase the font size of the heading */
.header h1 {
font-size: 40px;
}
/* Style the top navigation bar */
.navbar {
overflow: hidden;
background-color: #333;
}
/* Style the navigation bar links */
.navbar a {
float: left;
display: block;
color: white;
text-align: center;
padding: 14px 20px;
text-decoration: none;
}
/* Right-aligned link */
.navbar a.right {
float: right;
}
/* Change color on hover */
.navbar a:hover {
background-color: #ddd;
color: black;
}
/* Column container */
.row {
display: -ms-flexbox;
/* IE10 */
display: flex;
-ms-flex-wrap: wrap;
/* IE10 */
flex-wrap: wrap;
}
/* Create two unequal columns that sits next to each other */
/* Sidebar/left column */
.side {
-ms-flex: 30%;
/* IE10 */
flex: 30%;
background-color: #f1f1f1;
padding: 20px;
}
/* Main column */
.main {
-ms-flex: 70%;
/* IE10 */
flex: 70%;
background-color: white;
padding: 20px;
}
/* Fake image, just for this example */
.fakeimg {
background-color: #aaa;
width: 100%;
padding: 20px;
}
/* Footer */
.footer {
padding: 20px;
text-align: center;
background: #ddd;
}
#import url("https://fonts.googleapis.com/css?family=Lato:300,400|Poppins:300,400,800&display=swap");
.container {
width: 100%;
display: flex;
justify-content: center;
align-items: center;
}
.container * {
margin: 0;
padding: 0;
}
.container .box {
width: 250px;
position: relative;
display: flex;
justify-content: center;
flex-direction: column;
}
.container .box .title {
width: 100%;
position: relative;
display: flex;
align-items: center;
height: 50px;
}
.container .box .title .block {
width: 0%;
height: inherit;
background: #ffb510;
position: absolute;
animation: mainBlock 2s cubic-bezier(0.74, 0.06, 0.4, 0.92) forwards;
display: flex;
}
.container .box .title h1 {
font-family: 'Poppins';
color: #fff;
font-size: 32px;
-webkit-animation: mainFadeIn 2s forwards;
-o-animation: mainFadeIn 2s forwards;
animation: mainFadeIn 2s forwards;
animation-delay: 1.6s;
opacity: 0;
display: flex;
align-items: baseline;
position: relative;
}
.container .box .title h1 span {
width: 0px;
height: 0px;
-webkit-border-radius: 50%;
-moz-border-radius: 50%;
border-radius: 50%;
background: #ffb510;
-webkit-animation: load 0.6s cubic-bezier(0.74, 0.06, 0.4, 0.92) forwards;
animation: popIn 0.8s cubic-bezier(0.74, 0.06, 0.4, 0.92) forwards;
animation-delay: 2s;
margin-left: 5px;
margin-top: -10px;
position: absolute;
bottom: 13px;
right: -12px;
}
.container .box .wordCarousel {
font-size: 36px;
font-weight: 100;
color: #939393;
}
.container .box .wordCarousel div {
overflow: hidden;
position: relative;
float: left;
height: 45px;
padding-top: 5px;
margin-top: -10px;
}
.container .box .wordCarousel div li {
font-family: Serif;
color: #ccc;
font-weight: 250;
padding: 0 5px;
height: 45px;
margin-bottom: 45px;
display: block;
}
.flip4 {
animation: flip4 15s cubic-bezier(1, 1, 0.32, 1.2) infinite;
}
#keyframes flip4 {
0% {
margin-top: -360px;
}
5% {
margin-top: -270px;
}
25% {
margin-top: -270px;
}
30% {
margin-top: -180px;
}
50% {
margin-top: -180px;
}
55% {
margin-top: -90px;
}
75% {
margin-top: -90px;
}
80% {
margin-top: 0px;
}
99.99% {
margin-top: 0px;
}
100% {
margin-top: -270px;
}
}
#keyframes mainBlock {
0% {
width: 0%;
left: 0;
}
50% {
width: 100%;
left: 0;
}
100% {
width: 0;
left: 100%;
}
}
#keyframes secBlock {
0% {
width: 0%;
left: 0;
}
50% {
width: 100%;
left: 0;
}
100% {
width: 0;
left: 100%;
}
}
#keyframes mainFadeIn {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
#keyframes popIn {
0% {
width: 0px;
height: 0px;
background: #e9d856;
border: 0px solid #ddd;
opacity: 0;
}
50% {
width: 10px;
height: 10px;
background: #e9d856;
opacity: 1;
bottom: 45px;
}
65% {
width: 7px;
height: 7px;
bottom: 0px;
width: 15px;
}
80% {
width: 10px;
height: 10px;
bottom: 20px;
}
100% {
width: 7px;
height: 7px;
background: #e9d856;
border: 0px solid #222;
bottom: 13px;
}
}
#keyframes secFadeIn {
0% {
opacity: 0;
}
100% {
opacity: 0.5;
}
}
/* Responsive layout - when the screen is less than 700px wide, make the two columns stack on top of each other instead of next to each other */
#media screen and (max-width: 700px) {
.row {
flex-direction: column;
}
}
/* Responsive layout - when the screen is less than 400px wide, make the navigation links stack on top of each other instead of next to each other */
#media screen and (max-width: 400px) {
.navbar a {
float: none;
width: 100%;
}
}
</style>
</head>
<body>
<div class="header">
<div class="container">
<div class="box">
<div class="title">
<span class="block"></span>
<h1>Lane Willmore<span></span></h1>
</div>
<!-- here role goes -->
<h4 class="wordCarousel">
<div>
<!-- Use classes 2,3, or 4 to match the number of words -->
<ul class="flip4">
<li>word 1</li>
<li>word 2</li>
<li>word 3</li>
<li>word 4</li>
</ul>
</div>
</h4>
</div>
</div>
</div>
<div class="navbar">
Link
Link
Link
Link
</div>
<div class="row">
<div class="side">
<h2>About Me</h2>
<h5>Photo of me:</h5>
<div class="fakeimg" style="height:200px;">Image</div>
<p>Some text about me in culpa qui officia deserunt mollit anim..</p>
<h3>More Text</h3>
<p>Lorem ipsum dolor sit ame.</p>
<div class="fakeimg" style="height:60px;">Image</div><br>
<div class="fakeimg" style="height:60px;">Image</div><br>
<div class="fakeimg" style="height:60px;">Image</div>
</div>
<div class="main">
<h2>TITLE HEADING</h2>
<h5>Title description, Dec 7, 2017</h5>
<div class="fakeimg" style="height:200px;">Image</div>
<p>Some text..</p>
<p>Sunt in culpa qui officia deserunt mollit anim id est laborum consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco.</p>
<br>
<h2>TITLE HEADING</h2>
<h5>Title description, Sep 2, 2017</h5>
<div class="fakeimg" style="height:200px;">Image</div>
<p>Some text..</p>
<p>Sunt in culpa qui officia deserunt mollit anim id est laborum consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco.</p>
</div>
</div>
<div class="footer">
<h2>Footer</h2>
</div>
</body>
</html>

Related

Carousel code scrolls across screen #media 800px

I was wondering how would I get the boxes not to clash with one another in mobileview.
I have included all the code into mobile view, but certain boxes clash with one another how do I get it not to clash? I have how ever tried using just one line of code but it still would clash into one another.
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
.scroll-parent {
position: relative;
width: 100vw;
height: 20rem;
overflow-x: hidden;
}
.scroll-element {
width: inherit;
height: inherit;
position: absolute;
left: 0%;
top: 0%;
animation: primary 15s linear infinite;
}
#keyframes primary {
from {
left: 0%;
}
to {
left: -100%;
}
}
.primary {
animation: primary 15s linear infinite;
}
.secondary {
animation: secondary 15s linear infinite;
}
#keyframes primary {
from {
left: 0%;
}
to {
left: -100%;
}
}
#keyframes secondary {
from {
left: 100%;
}
to {
left: 0%;
}
}
.wrapper{
display: flex;
justify-content: center;
align-items: center;
overflow: hidden;
}
.wrapper .carousel{
display: flex;
justify-content: space-between;
padding: 0 30px;
}
.wrapper .card{
background: #e74c3c;
line-height: 250px;
text-align: center;
color: #fff;
font-size: 90px;
width: 280px;
font-weight: 600;
margin: 20px 20px;
border-radius: 8px;
box-shadow: 0 4px 8px rgba(0,0,0,.2);
pointer-events: none;
}
.wrapper .card{
display: flex;
justify-content: space-around;
position: relative;
left: 185px;
animation: carousel 5s linear infinite;
}
.carousel .card .cards{
overflow: hidden;
}
.carousel .card.cards-2{
background: #3498db;
}
.carousel .card.cards-3{
background: #16a085;
}
.carousel .card.cards-4{
background: #2c3e50;
}
.carousel .card.cards-5{
background: #630460;
}
#media only screen and (max-width: 800px){
.scroll-parent {
position: relative;
width: 100vw;
height: 20rem;
overflow-x: hidden;
}
.scroll-element {
width: inherit;
height: inherit;
position: absolute;
left: 0%;
top: 0%;
animation: primary 15s linear infinite;
}
#keyframes primary {
from {
left: 0%;
}
to {
left: -100%;
}
}
.primary {
animation: primary 15s linear infinite;
}
.secondary {
animation: secondary 15s linear infinite;
}
#keyframes primary {
from {
left: 0%;
}
to {
left: -100%;
}
}
#keyframes secondary {
from {
left: 100%;
}
to {
left: 0%;
}
}
.wrapper{
display: flex;
justify-content: center;
align-items: center;
overflow: hidden;
}
.wrapper .carousel{
display: flex;
justify-content: space-between;
padding: 0 30px;
}
.wrapper .card{
background: #e74c3c;
line-height: 250px;
text-align: center;
color: #fff;
font-size: 90px;
width: 280px;
font-weight: 600;
margin: 20px 20px;
border-radius: 8px;
box-shadow: 0 4px 8px rgba(0,0,0,.2);
pointer-events: none;
}
.wrapper .card{
display: flex;
justify-content: space-around;
position: relative;
left: 185px;
animation: carousel 5s linear infinite;
}
.carousel .card .cards{
overflow: hidden;
}
.carousel .card.cards-2{
background: #3498db;
}
.carousel .card.cards-3{
background: #16a085;
}
.carousel .card.cards-4{
background: #2c3e50;
}
.carousel .card.cards-5{
background: #630460;
}
}
<div class="scroll-parent">
<div class="scroll-element primary">
<div class="wrapper">
<div class="carousel">
<div class="card cards-1">A</div>
<div class="card cards-2">B</div>
<div class="card cards-3">C</div>
<div class="card cards-4">D</div>
<div class="card cards-5">E</div>
</div>
</div>
</div>
<div class="scroll-element secondary">
<div class="wrapper">
<div class="carousel">
<div class="card cards-1">A</div>
<div class="card cards-2">B</div>
<div class="card cards-3">C</div>
<div class="card cards-4">D</div>
<div class="card cards-5">E</div>
</div>
</div>
</div>
</div>

How to create expanding line animation from this base?

So I want to create this animation where basically this happens:
When you hover on an icon, it gets bigger, increases in opacity, and some text appears.
In addition to this, 2 lines of color extend in width from the center out to the sides, then they increase in height.
The bottom color should expand downwards, while the top color should expand upwards.
I created this test-base and was wondering how I would go about making this from here. I tried tweaking the height, width, and opacity but those also edit the icon, so I'm wondering if I'm taking the wrong approach or just doing it wrong. Any help and/or pointers are appreciated.
Current code:
* {
margin: 0;
padding: 0;
font-family: "Consolas";
}
body {
background: #212121;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
}
.hoverCard {
position: relative;
display: flex;
flex-direction: column;
align-items: center;
width: 320px;
height: 480px;
border-radius: 30px;
background: #191919;
overflow: hidden;
}
.hoverCard::before {
background: blue;
content: "";
position: absolute;
width: 100%;
height: 50%;
transition: 0.5s;
}
.hoverCard .mainImg {
opacity: 0.25;
height: 160px;
width: 160px;
transition: 0.5s;
margin: 10;
margin-top: 50%;
}
.hoverCard .mainText {
opacity: 0;
color: blue;
margin-top: 0%;
transition: 0.5s;
}
.hoverCard .subText {
opacity: 0;
color: blue;
margin-top: 0%;
transition: 0.5s;
}
.mainImg:hover {
transform: scale(1.5);
opacity: 1;
margin-top: 30%;
}
.mainImg:hover~.mainText {
margin-top: 20%;
opacity: 1;
}
.mainImg:hover~.subText {
margin-top: 25%;
opacity: 1;
}
<html>
<head>
<link rel="stylesheet" href="main.css">
</head>
<body>
<div class="hoverCard">
<img class="mainImg" src="../Media/Link-Logos/Discord.png">
<p class="mainText">Discord</p>
<p class="subText">Ex0tic_Python#7571</p>
</div>
</body>
</html>
As the requirement is to have lines drawn and expanding when the image is hovered, and the image itself cannot have pseudo elements, this snippet adds a further element after the img, .lines.
This is positioned absolutely and sized relative to the overall card (parent) element.
It has before and after pseudo elements which draw lines and then expand vertically using a CSS animation.
As I was unclear what you wanted to happen about the line going downwards (if it keeps the same background color as the card then of course it can't be seen) so this snippet makes it pink.
Of course you will want to alter timings and perhaps dimensions to suit your specific requirements, this is just a simple example to demonstrate one possibility.
<html>
<head>
<link rel="stylesheet" href="main.css">
<style>
* {
margin: 0;
padding: 0;
font-family: "Consolas";
}
body {
background: #212121;
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
}
.hoverCard {
position: relative;
display: flex;
flex-direction: column;
align-items: center;
width: 320px;
height: 480px;
border-radius: 30px;
overflow: hidden;
}
.hoverCard .mainImg {
opacity: 0.25;
height: 160px;
width: 160px;
transition: 0.5s;
margin: 10;
margin-top: 50%;
}
.hoverCard .mainText {
opacity: 0;
color: blue;
margin-top: 0%;
transition: 0.5s;
}
.hoverCard .subText {
opacity: 0;
color: blue;
margin-top: 0%;
transition: 0.5s;
}
.mainImg:hover {
transform: scale(1.5);
opacity: 1;
margin-top: 30%;
}
.mainImg:hover~.mainText {
margin-top: 20%;
opacity: 1;
}
.mainImg:hover~.subText {
margin-top: 25%;
opacity: 1;
}
.lines {
content: '';
position: absolute;
width: 100%;
height: 100%;
z-index: -1;
display: flex;
justify-content: center;
background-color: #191919;
}
.lines::before,
.lines::after {
content: '';
margin: 0 auto;
position: absolute;
width: 160px;
height: 10px;
opacity: 0;
}
.lines::before {
background-color: blue;
bottom: 50%;
}
.lines::after {
background-color: pink;
top: 50%;
}
#keyframes expand {
0% {
opacity: 0;
width: 160px;
height: 10px;
}
9.99% {
opacity: 0;
}
10% {
width: 240px;
opacity: 1;
}
50% {
width: 100%;
height: 10px;
}
100% {
opacity: 1;
width: 100%;
height: 100%;
}
}
.mainImg:hover~.lines::before,
.mainImg:hover~.lines::after {
display: block;
animation: expand 3s linear forwards 0.3s;
}
</style>
</head>
<body>
<div class="hoverCard">
<img class="mainImg" src="https://picsum.photos/id/1015/200/200">
<div class="lines"></div>
<p class="mainText">Discord</p>
<p class="subText">Ex0tic_Python#7571</p>
</div>
</body>
</html>

CSS not working within Reactjs like another project

CSS not working within Reactjs like another project.
I am working on a project within Reactjs and for my home page I want to have a particular UI/UX and I have made it within regular HTML/CSS (see: https://replit.com/#Reverence/DistantUnconsciousFibonacci#index.html). But when I add the code to my react project (see: https://replit.com/#Reverence/MemorableExperiencedGoal#src/App.jsx) it is somewhat off and not what I had written before despite it being the same code. Is there something I'm missing?
Here is the CSS:
#import url('https://fonts.googleapis.com/css2?family=Poppins&family=Source+Sans+Pro&display=swap');
*{
box-sizing: border-box;
padding: 0;
margin: 0;
}
body{
background-color: #0d1721;
}
#box{
margin: 0;
padding: 0;
position: relative;
display: inline-block;
width: calc(32vw - 3px);
height: 100vh;
text-align: center;
}
#box:hover{
cursor: pointer;
animation: hoverAnimation 1.5s forwards;
}
#keyframes hoverAnimation {
0% {background-color: #009688; height: 0vh;}
100% {background-color: #009688; height: 100vh;}
}
#keyframes fadeInDown {
0% {opacity: 0; transform: translateY(-20px);}
100% {opacity: 1;transform: translateY(0);}
}
.title{
font-family: Poppins, sans-serif;
color: #FBFCFC;
text-align: center;
padding-top: 35vh;
display: inline-block;
height: 100vh;
font-size: 30px;
font-weight: 600;
text-decoration-line: none;
animation: fadeInDown 2s;
}
.title::after {
content: "";
display: block;
margin: 5px auto 0 auto;
height: 2px;
width: 0px;
background-color: #FBFCFC;
}
.title:hover::after {
width: 100%;
transition: all 0.5s;
}
#media screen and (max-width: 820px){
#box{width:100vw!important;padding:0!important;height:0!important;}
}
#mountains{
margin: 0;
padding: 0;
position: relative;
display: inline-block;
width: calc(33.3% - 3px);
height: 100vh;
text-align: center;
background-image: url("https://distantunconsciousfibonacci.reverence.repl.co/mountains.jpg");
}
#mountains:hover{
cursor: pointer;
animation: hoverAnimation 1.5s forwards;
}
#piedmont{
margin: 0;
padding: 0;
position: relative;
display: inline-block;
width: calc(33.3% - 3px);
height: 100vh;
text-align: center;
background-image: url("https://distantunconsciousfibonacci.reverence.repl.co/boat.png");
}
#piedmont:hover{
cursor: pointer;
animation: hoverAnimation 1.5s forwards;
}
#coast{
margin: 0;
padding: 0;
position: relative;
display: inline-block;
width: calc(33.3% - 3px);
height: 100vh;
text-align: center;
background-image: url("https://distantunconsciousfibonacci.reverence.repl.co/coastal-waterway.jpg");
}
#coast:hover{
cursor: pointer;
animation: hoverAnimation 1.5s forwards;
}

HTML CSS - display: inline-block can't center the container with % width

Creating my website and cant make my container with list of elements centerd if I want my grid responsive and have the display: block or display: inline-block and have a % width
heres a the situation im in. I want the grid with blocks to be responsive and have display: block/ display: inline-block (I have this bcs when u click on the button web scraping a button it will hide one of the blocks and I want it to float: left so one of the blocks doent center when one disperse)
$(document).ready(function(){
$("#web-scraping").click(function(){
if($("#web-s").hasClass("hide")){
$('#web-s').removeClass('hide');
}
else{
$("#web-s").addClass('hide')
}
});
});
*{
padding: 0;
margin: 0;
box-sizing: border-box;
}
html{
font-size: 10px;
font-family: sofia_pro;
}
a{
text-decoration: none;
}
.container{
min-height: 65vh;
width: 100%;
display: flex;
align-items: center;
justify-content: center;
}
#hero{
background-color: #32312F;
position: relative;
z-index: 1;
}
#hero .hero{
max-width: 1500px;
margin: 0 auto;
padding: 0 50px;
justify-content: flex-start;
}
#hero h1{
display: block;
width: fit-content;
font-size: 5rem;
position: relative;
color: transparent;
animation: text_reveal .5s ease forwards;
animation-delay: 1s;
}
#hero h1 span{
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 0;
background-color: #fff;
animation: text_reveal_box 1s ease;
animation-delay: 0.5s;
}
#hero p{
display: block;
width: 40%;
font-size: 2rem;
margin-top: 60px;
position: relative;
color: transparent;
animation: text_reveal .5s ease forwards;
animation-delay: 1s;
}
#hero .button-box{
margin-top: 40px;
height: 35px;
width: 140px;
}
#hero .cta{
display: inline-block;
padding: 8px 20px;
color: #fff;
background-color: transparent;
border: 1px solid #fff;
font-size: 1.5rem;
visibility: hidden;
text-transform: uppercase;
position: relative;
transition: .3s ease background-color;
opacity: 1;
animation: box_reveal .5s ease forwards;
animation-delay: 1s;
}
#hero .cta span{
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 0;
background-color: #fff;
animation: box_reveal_box 1s ease;
animation-delay: .5s;
}
#hero .cta:hover{
box-shadow:0px 0px 0px 1px #fff inset;
}
/*animation*/
#keyframes text_reveal_box{
50%{
width: 100%;
left: 0;
}
100%{
width: 0;
left: 100%;
}
}
#keyframes box_reveal_box{
50%{
width: 100%;
left: 0;
}
100%{
width: 0;
left: 100%;
}
}
#keyframes text_reveal{
100%{
color: #fff;
}
}
#keyframes box_reveal{
100%{
visibility: visible;
}
}
.down-pointer{
align-items: center;
justify-content: center;
display: flex;
position: relative;
z-index: 3;
top: -160px;
}
.down-pointer .left{
width: 20px;
height: 20px;
transition: .5s;
float: left;
box-shadow: -2px 2px;
color: #f6f6f6;
}
.down-pointer .left{
transform: rotate(-45deg);
}
.work-container{
background-color: #f6f6f6;
height: 1000px;
max-width: 1300px;
border-radius: 20px 20px 0px 00px;
margin: 0px 60px;
top: -100px;
padding: 100px;
position: relative;
z-index: 2;
}
.work-category{
align-items: center;
justify-content: center;
display: flex;
}
.work-category button{
text-transform: capitalize;
border: 1px solid #32312F;
padding: 15px 30px;
font-size: 1.5rem;
font-weight: 600;
border-radius: 3px;
color: #32312F;
outline: none;
cursor: pointer;
}
.work-category button:hover{
}
#web-scraping{
margin: auto 100px auto auto;
}
#web-design{
margin: auto 0px auto 0px;
}
#web-animation{
margin: auto auto auto 100px;
}
.work-block-container .hide{
display: none;
}
.work-block-container-flex{
}
.work-block-container{
margin: 0 auto;
display: inline-block;
overflow: hidden;
width: 100%;
}
.work-block{
background-color: black;
float: left;
width: 30%;
height: 180px;
border-radius: 3px;
padding: 20px;
margin: 5px;
}
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script type="text/javascript" src="js/javascript.js"></script>
<link rel="stylesheet" href="css/style.css">
<link rel="stylesheet" href="css/animation.css">
<link rel="stylesheet" href="css/media-screen.css">
<title>The HTML5 Herald</title>
</head>
<body>
<!-- Starting-menu-->
<section id=hero>
<div class="hero">
<div class="hero container">
<div>
<h1>What I can do,<span></span></h1>
<h1>for your Business<span></span></h1>
<p><span>
It is a long established fact that a reader will be distracted by
the readable content of a page when looking at its layout. The point
of using Lorem Ipsum is that it has a more-or-less normal distribution
</span></p>
<div class="button-box">Contact Me<span></span></div>
</div>
</div>
</div>
</section>
<!-- End-->
<!-- my work -->
<section class="work-container">
<a class="down-pointer" href="#"><span class="left"></span></a>
<div class="work-category">
<button id="web-scraping">Web Scraping</button>
<button id="web-design">Web Design</button>
<button id="web-animation">web animation</button>
</div>
<div class="work-block-container">
<div class="work-block" id="web-s"></div>
<div class="work-block" id="web-d"></div>
<div class="work-block" id="web-s"></div>
<div class="work-block" id="web-d"></div>
<div class="work-block" id="web-d"></div>
<div class="work-block" id="web-a"></div>
</div>
</section>
<!-- my work end -->
<!-- about me -->
<div class="container about" id="">
<h1>About</h1>
<div class="about-me-info">
<p></p>
<p></p>
<p></p>
</div>
</div>
<!-- about me end-->
<!-- contact me -->
<!-- contact me end -->
</body>
</html>
I think you use another <div> in your container so your flex or grid display just effect on that div!
try display flex or grid on that div or make your container as your element's parents.
First, the ID for each element must be unique. I think you achieved this))
$(document).ready(function(){
$("#web-scraping").click(function(){
$(".web-d").addClass("hide")
$(".web-a").addClass("hide")
$(".web-s").removeClass("hide")
});
$("#web-design").click(function(){
$(".web-d").removeClass("hide")
$(".web-a").addClass("hide")
$(".web-s").addClass("hide")
});
$("#web-animation").click(function(){
$(".web-d").addClass("hide")
$(".web-a").removeClass("hide")
$(".web-s").addClass("hide")
});
});
*{
padding: 0;
margin: 0;
box-sizing: border-box;
}
html{
font-size: 10px;
}
a{
text-decoration: none;
}
.container{
min-height: 65vh;
width: 100%;
display: flex;
align-items: center;
justify-content: center;
}
#hero{
background-color: #32312F;
position: relative;
z-index: 1;
}
#hero .hero{
max-width: 1500px;
margin: 0 auto;
padding: 0 50px;
justify-content: flex-start;
}
#hero h1{
display: block;
width: fit-content;
font-size: 5rem;
position: relative;
color: transparent;
animation: text_reveal .5s ease forwards;
animation-delay: 1s;
}
#hero h1 span{
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 0;
background-color: #fff;
animation: text_reveal_box 1s ease;
animation-delay: 0.5s;
}
#hero p{
display: block;
width: 40%;
font-size: 2rem;
margin-top: 60px;
position: relative;
color: transparent;
animation: text_reveal .5s ease forwards;
animation-delay: 1s;
}
#hero .button-box{
margin-top: 40px;
height: 35px;
width: 140px;
}
#hero .cta{
display: inline-block;
padding: 8px 20px;
color: #fff;
background-color: transparent;
border: 1px solid #fff;
font-size: 1.5rem;
visibility: hidden;
text-transform: uppercase;
position: relative;
transition: .3s ease background-color;
opacity: 1;
animation: box_reveal .5s ease forwards;
animation-delay: 1s;
}
#hero .cta span{
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 0;
background-color: #fff;
animation: box_reveal_box 1s ease;
animation-delay: .5s;
}
#hero .cta:hover{
box-shadow:0 0 0 1px #fff inset;
}
/*animation*/
#keyframes text_reveal_box{
50%{
width: 100%;
left: 0;
}
100%{
width: 0;
left: 100%;
}
}
#keyframes box_reveal_box{
50%{
width: 100%;
left: 0;
}
100%{
width: 0;
left: 100%;
}
}
#keyframes text_reveal{
100%{
color: #fff;
}
}
#keyframes box_reveal{
100%{
visibility: visible;
}
}
.down-pointer{
align-items: center;
justify-content: center;
display: flex;
position: relative;
z-index: 3;
top: -160px;
}
.down-pointer .left{
width: 20px;
height: 20px;
transition: .5s;
float: left;
box-shadow: -2px 2px;
color: #f6f6f6;
}
.down-pointer .left{
transform: rotate(-45deg);
}
.work-container{
background-color: #f6f6f6;
height: 1000px;
max-width: 1300px;
border-radius: 20px 20px 0px 00px;
margin: 0 60px;
top: -100px;
padding: 100px;
position: relative;
z-index: 2;
}
.work-category{
align-items: center;
justify-content: center;
display: flex;
}
.work-category button{
text-transform: capitalize;
border: 1px solid #32312F;
padding: 15px 30px;
font-size: 1.5rem;
font-weight: 600;
border-radius: 3px;
color: #32312F;
outline: none;
cursor: pointer;
}
.work-category button:hover{
}
#web-scraping{
margin: auto 100px auto auto;
}
#web-design{
margin: auto 0 auto 0;
}
#web-animation{
margin: auto auto auto 100px;
}
.work-block-container-flex{
}
.work-block-container{
margin: 0 auto;
display: inline-block;
overflow: hidden;
width: 100%;
}
.work-block{
float: left;
width: 30%;
height: 180px;
border-radius: 3px;
padding: 20px;
margin: 5px;
transition: 0.7s all;
}
.work-block.web-s{
background-color: green;
}
.work-block.web-d{
background-color: blue;
}
.work-block.web-a{
background-color: red;
}
.work-block.web-s.hide{
width: 0;
height: 0;
visibility: hidden;
padding: 0;
margin: 0;
}
.work-block.web-d.hide{
width: 0;
height: 0;
visibility: hidden;
padding: 0;
margin: 0;
}
.work-block.web-a.hide{
width: 0;
height: 0;
visibility: hidden;
padding: 0;
margin: 0;
}
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="./style.css">
<title>The HTML5 Herald</title>
</head>
<body>
<!-- Starting-menu-->
<section id=hero>
<div class="hero">
<div class="hero container">
<div>
<h1>What I can do,<span></span></h1>
<h1>for your Business<span></span></h1>
<p><span>
It is a long established fact that a reader will be distracted by
the readable content of a page when looking at its layout. The point
of using Lorem Ipsum is that it has a more-or-less normal distribution
</span></p>
<div class="button-box">Contact Me<span></span></div>
</div>
</div>
</div>
</section>
<!-- End-->
<!-- my work -->
<section class="work-container">
<a class="down-pointer" href="#"><span class="left"></span></a>
<div class="work-category">
<button id="web-scraping">Web Scraping</button>
<button id="web-design">Web Design</button>
<button id="web-animation">web animation</button>
</div>
<div class="work-block-container">
<div class="work-block web-s"></div>
<div class="work-block web-d"></div>
<div class="work-block web-s"></div>
<div class="work-block web-d"></div>
<div class="work-block web-d"></div>
<div class="work-block web-a"></div>
</div>
</section>
<!-- my work end -->
<!-- about me -->
<div class="container about" id="">
<h1>About</h1>
<div class="about-me-info">
<p></p>
<p></p>
<p></p>
</div>
</div>
<!-- about me end-->
<!-- contact me -->
<!-- contact me end -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script type="text/javascript" src="./js.js"></script>
</body>
</html>

I need to reduce the gap between the headings when resizing the browser

This the code i have used but, when i resize the browser, the space between the two headings for the tab view is not working. I should get the texts without the space when i resize the browser.Below is the html and css code i have used to make it happen but, its not working,could you please help me through this.
Here is the my code:
body {
width: 100%;
overflow-x: hidden;
overflow-y: auto;
padding: 0;
display:block;
padding-top: 100px;
background-size:100%;
margin: 0;
}
#header{
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100px;
background: #FFF;
border-bottom: 2px solid #000;
}
#carscene{
width: 100%;
height: 113vh;
background: url('app-car-scene-min.png') no-repeat;
background-size: contain;
color: #FFF;
font-family :"Source Sans Pro", Arial, Helvetica, sans-serif;
position: relative;
background-position: top -175px left -2px;
background-size: 108% 151%;
}
#carscene #title-holder{
position: absolute;
top: 30vh;
left: 8vw;
overflow: hidden;
padding-bottom: 50px;
height: 6vw;
width: 70vw;
}
#carscene #title-holder h1{
position: absolute;
font-size: 5vw;
font-weight: bold;
animation: emerge-up 2s ease-out;
margin: 0;
padding: 0;
top: 6%;
animation-duration: 2.5s;
}
#-webkit-keyframes emerge-up {
0% {
top: 250%;
}
10% {
top: 250%;
}
65% {
top: -15%;
}
100% {
top: 5%;
}
}
#keyframes emerge-up {
0% {
top: 250%;
}
10% {
top: 250%;
}
65% {
top: -15%;
}
100% {
top: 5%;
}
}
#everymin {
width: 100%;
height: 25vh;
background: #abc;
}
#carscene h2 {
position: absolute;
font-size: 2vw;
font-weight: bold;
margin: 0;
padding-left: 13.5vw;
top: 48vh;
left:-8vh;
opacity: 0;
animation-delay: 1.5s;
transform: scale(0);
animation-fill-mode: forwards;
}
.scale-in {
transform: scale(1);
animation-name: scaleIn;
animation-iteration-count: 1;
animation-timing-function: ease;
animation-duration: 1.5s;
}
#-webkit-keyframes scaleIn {
0% {
opacity: 0;
transform: scale(0.8);
}
50% {
opacity: 1;
}
100% {
opacity: 1;
transform: scale(1);
}
}
#keyframes scaleIn {
0% {
opacity: 0;
transform: scale(0.8);
}
50% {
opacity: 1;
}
100% {
opacity: 1;
transform: scale(1);
}
}
#carscene #title-button {
position: absolute;
bottom: 52vh;
left: 9.5vw;
overflow: hidden;
height: 11vh;
width: 50vw;
animation-duration: 3.5s;
top:57vh;
}
#carscene h3 {
position: absolute;
width: 18vw;
font-size: 2.5vh;
background: #35baf2;
height: 6vh;
margin: -1px;
padding-top: 20px;
left: 0vh;
bottom: 100px;
border-radius: 9px;
text-align: center;
animation: emerge-down 1.5s ease forwards;
animation-delay: 2.2s;
}
#-webkit-keyframes emerge-down {
0% {
bottom: 100px;
}
100% {
bottom: 15px;
}
}
#keyframes emerge-down {
0% {
bottom: 100px;
}
100% {
bottom: 15px;
}
}
#carscene #title-check {
position: absolute;
top: 67vh;
left: -8vw;
overflow: hidden;
height: 20vh;
width: 50vw;
}
#carscene ul{
position: absolute;
font-size: 1.6vw;
margin: 0;
padding-left: 13.5vw;
top: -8%;
list-style: none;
white-space:pre;
animation-duration: 6s;
transition: transform .4s ease-in-out, opacity .4s ease-in-out;
}
.fa-check-square-o:before {
content: "\f046";
font-size: 90%;
color: rgb(0,206,89);
}
.fade-in {
animation-name: fadeInOpacity;
animation-iteration-count: 1;
animation-timing-function: ease-in;
animation-delay: 3s;
opacity: 0;
animation-fill-mode: forwards;
animation-duration: 1.5s;
}
#keyframes fadeInOpacity {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
#media only screen and (min-device-width:320px) and (max-width: 480px) {
#carscene{
background: url('app-car-scene-min.png') no-repeat;
background-position: right 20% bottom -251px;
background-size:333% 140%;
width:100%;
height:116%;
}
#carscene #title-holder {
height: 13vw;
width: 80vw;
top: 10vh;
left: 11vw;
max-height:100%;
}
#carscene #title-holder h1 {
font-size: 8.5vw;
}
#carscene h2 {
font-size: 4vw;
padding-left: 10.5vw;
top: 19vh;
left:0vh;
}
#carscene #title-button {
left: 23vw;
height: 9vh;
top: 26vh;
border-radius:6px;
}
#carscene h3 {
width: 52vw;
font-size: 2.5vh;
height: 6vh;
border-radius:3px;
min-height:100%;
}
#carscene #title-check {
top: 35vh;
left: 0vw;
width: 100%;
}
#carscene ul {
font-size: 4.2vw;
white-space:inherit;
padding: 0;
width: 100%;
left:7vh;
top:2%;
}
li {
float: left;
padding-left: 5%;
}
#everymin {
width: 100%;
height: 25vh;
background: #abc;
}
}
#media (min-device-width: 480px) and (max-device-width: 778px) {
#carscene{
background: url('app-car-scene-min.png') no-repeat;
background-position:right -125px bottom 399px;
background-size: 150% 80%;
width:105%;
height:127%;
position:relative;
}
#carscene #title-holder {
top: 3vh;
left: 8vw;
height: 33vw;
width: 30vw;
position:absolute;
}
#carscene #title-holder h1 {
font-size: 8vw;
top:6%;
}
#carscene h2 {
padding-left: 6.5vw;
font-size: 3vw;
top: 31vh;
left:0vh;
width:100%;
}
#carscene #title-text {
position: absolute;
width: 50vw;
top: -4vh;
}
#carscene #title-button {
height: 11vh;
width: 50vw;
max-height:100%;
top: 34vh;
left: 5vw;
position:absolute;
}
#carscene h3 {
width: 43vw;
overflow:auto;
margin:2px;
padding-top:24px;
font-size:2.5vh;
}
#carscene ul {
font-size: 27px;
padding-left:0.5vw;
overflow:auto;
position:absolute;
}
#carscene #title-check {
top: 43vh;
left: -6vw;
}
}
#media (min-width: 779px) and (max-width: 1024px){
#carscene {
background: url('app-car-scene-min.png') no-repeat;
background-size: contain;
width:107%;
height:122%;
}
#carscene #title-holder h1 {
font-size: 5.3vw;
}
#carscene #title-holder {
top: 15vh;
left: 8vw;
}
#carscene h2 {
top: 23vh;
left: -5vw;
font-size:2.3vw;
}
#carscene h3 {
width: 38vw;
}
#carscene #title-button {
left: 9vw;
top: 25vh;
width:36vw;
text-align:center;
}
#carscene #title-check {
top: 29vh;
left: -11vw;
}
#carscene ul {
font-size: 2.7vw;
top:25%;
}
}
<head>
<title>Lucep Banner work</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://fonts.googleapis.com/css?family=Source+Sans+Pro" rel="stylesheet">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
<link rel='stylesheet' href='banner.css' type='text/css' media='all' />
</head>
<body>
<div id="header">Lucep logo header</div>
<div id="carscene">
<div id="title-holder">
<h1>Capture. Call. Convert.</h1>
</div>
<div id="title-text">
<h2 class="scale-in">Call back customers faster than your competition</h2>
</div>
<div id="title-button">
<h3>Start Your Free Trial ►</h3>
</div>
<div id="title-check" class="fade-in">
<ul>
<i class="fa fa-check-square-o fa_custom"> No credit card required</i>
<i class="fa fa-check-square-o fa_custom"> 30 day free trial</i>
</ul>
</div>
</div>
<div id="everymin">
<h1>Every minute matters</h1>
bla bla bla
</div>
</body>
The problem in the code was it doesn't have equalized height formatting for each div in the body section.Adjust them in relative way to get your web page.