CSS not working within Reactjs like another project - html

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;
}

Related

My transition for a <div>'s height is not taking place in my pen on codepen.io

So, I've got my own pen on codepen.io using a transition to change the height, and I don't know what's happening. CAN SOMEBODY HELP ME Please? I've got a single clue why but for some reason 1 of them is working?? I'm SUPER confused, this is not like a normal web-developing time to me.. sort of I've tried my best to think of why it might work myself but I've managed to get 0 luck D-:
So I tried this code:
HTML:
<div class="card">
<div class="text">
<h3>A Title</h3>
<p>A Description for the story</p>
</div>
</div>
CSS:
html, body {
margin: 0;
font-family: "Rubik", sans-serif;
width: 100%;
height: 100%;
background: hsl(0, 0%, 10%);
overflow: hidden;
}
.card {
position: relative;
background-image: url("/images/MyImage.png");
background-size: cover;
width: calc(66vw - 4rem);
height: 50vh;
padding: 20px;
border-radius: 1rem;
margin: 2rem;
overflow: hidden;
}
.text {
background: black;
box-shadow: 0 0 2rem 5rem black;
position: absolute;
left: 0;
bottom: 0;
height: auto;
width: inherit;
transition-timing-function: ease;
transition-duration: .5s;
}
.card:hover .text {
height: 3rem;
}
.text h3 {
margin: 0;
position: absolute;
bottom: 1rem;
left: 1rem;
color: white;
transition-timing-function: ease;
transition-duration: .5s;
cursor: default;
}
.card:hover h3 {
position: absolute;
bottom: 50vh;
}
.text p {
position: absolute;
display: none;
bottom: 1rem;
left: 1rem;
color: white;
margin: 0;
transition-timing-function: ease;
transition-duration: .5s;
}
.card:hover .text p {
display: block;
}
h3::selection, p::selection {
background: transparent;
}
can anybody tell me why the paragraph and the text just won't come up with a transition, I gave you everything in case anything isn't supposed to be like that. and by the way the image is a tropical beach with a non-used name by me, I just wanted you to know that there's ACTUALLY an image there just incase it has anything to do with it's children's transitions.
To make transitions you need a starting point and an ending point. However, not all properties "create" a smooth transition, for example from display: none; to display: block; no transition will be created (same from visibility: hidden to visible).
For this reason, if you want to create smooth transitions you have to use properties that allow you to do this. In this case for the p you have to use the opacity, while for the div you can't make a smooth transition from auto to 3rem, so you will be forced to set a height other than auto.
html, body {
margin: 0;
font-family: "Rubik", sans-serif;
width: 100%;
height: 100%;
background: hsl(0, 0%, 10%);
overflow: hidden;
}
.card {
position: relative;
background-image: url("/images/MyImage.png");
background-size: cover;
width: calc(66vw - 4rem);
height: 50vh;
padding: 20px;
border-radius: 1rem;
margin: 2rem;
overflow: hidden;
}
.text {
background: black;
box-shadow: 0 0 2rem 5rem black;
position: absolute;
left: 0;
bottom: 0;
height: .5rem;
width: inherit;
transition-timing-function: ease;
transition-duration: .5s;
}
.card:hover .text {
height: 3rem;
}
.text h3 {
margin: 0;
position: absolute;
bottom: 1rem;
left: 1rem;
color: white;
transition-timing-function: ease;
transition-duration: .5s;
cursor: default;
}
.card:hover h3 {
position: absolute;
bottom: 50vh;
}
.text p {
position: absolute;
opacity: 0;
visibility: hidden;
bottom: 1rem;
left: 1rem;
color: white;
margin: 0;
transition-timing-function: ease;
transition-duration: .5s;
}
.card:hover .text p {
visibility: visible;
opacity: 1;
}
h3::selection, p::selection {
background: transparent;
}
<div class="card">
<div class="text">
<h3>A Title</h3>
<p>A Description for the story</p>
</div>
</div>

how to stop text animation in css

My animation is not ending at the end of text what do I do to make it stop after displaying some text.
h2 {
justify-content: center;
position: relative;
font-size: 14vw;
color: #ffffff;
-webkit-text-stroke: 0.3vw #ffffff;
text-transform: uppercase;
}
h2::before {
content: attr(data-text);
position: absolute;
top: 0;
left: 0;
width: 0;
height: 100%;
color: #01fe87;
-webkit-text-stroke: 0vw #ffffff;
border-right: 2px solid #ffffff;
overflow: hidden;
animation: animate 6s linear;
}
#keyframes animate {
0%,
100% {
width: 0;
}
70%,
90% {
width: 100%;
}
}
<h2 data-text="Hi..">Hi..</h2>
I'm a beginner so don't know a lot of things
h2 {
justify-content: center;
position: relative;
font-size: 14vw;
color: #ffffff;
-webkit-text-stroke: 0.3vw #ffffff;
text-transform: uppercase;
}
h2::before {
content: attr(data-text);
position: absolute;
top: 0;
left: 0;
width: 0;
height: 100%;
color: #01fe87;
-webkit-text-stroke: 0vw #ffffff;
border-right: 2px solid #ffffff;
overflow: hidden;
animation: animate 6s linear;
}
#keyframes animate {
0%,
100% {
width: 0;
}
70%,
90% {
width: 100%;
}
}
<h2 data-text="Hi Atih <3">Hi Atih <3</h2>
I just played with width and it works
width: 0; was causing the issue
h2 {
justify-content: center;
position: relative;
font-size: 14vw;
color: #ffffff;
-webkit-text-stroke: 0.3vw #ffffff;
text-transform: uppercase;
}
h2 {
content: attr(data-text);
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
color: #01fe87;
-webkit-text-stroke: 0vw #ffffff;
border-right: 2px solid #ffffff;
overflow: hidden;
animation: animate 6s linear;
animation-fill-mode: forwards;
}
#keyframes animate {
0% {
width: 100px;
height: 100px;
}
100% {
width: 100%;
height: 100%;
}
}
<h2 data-text="Hi..">Hi..</h2>

CSS Skill Bar Animation

I am trying to create a skill bar where the background color of the progress slides in but the label for the Skill bar stays in the same place.
.skill-container * {
box-sizing: border-box;
}
.skill-container {
width: 100%;
border-radius: 5px;
background-color: lightgray;
margin: 20px 0;
overflow: hidden;
}
.skill-container .skill {
display: inline-block;
text-align: left;
color: white;
padding: 10px 0 10px 4px;
border-radius: inherit;
background-color: #312E81;
white-space: nowrap;
position: relative;
animation: animateLeft 1s ease-out;
}
#keyframes animateLeft {
from {
left: -100%
}
to {
left: 0
}
}
.skill-container .skill.skill-level-70 {
width: 70%
}
<div class="skill-container">
<span class="skill skill-level-70">CSS</span>
</div>
So far the animation works well, but the only thing I need to figure out is how to keep the text (CSS) on the left and animate the sliding of the background color to show the progress
Use a pseudo element for the background:
.skill-container .skill {
color: white;
background-color: lightgray;
margin: 5px 0;
padding: 10px 0 10px 4px;
overflow: hidden;
border-radius: 5px;
white-space: nowrap;
position: relative;
z-index:0;
}
.skill-container .skill::before {
content: "";
position: absolute;
background-color: #312E81;
border-radius: inherit;
z-index: -1;
top: 0;
bottom: 0;
left: 0;
animation: animateLeft 1s ease-out;
}
#keyframes animateLeft {
from {
transform: translateX(-100%);
}
}
.skill-container .skill.skill-level-70::before {
width: 70%
}
.skill-container .skill.skill-level-40::before {
width: 40%
}
.skill-container .skill.skill-level-100::before {
width: 100%
}
<div class="skill-container">
<div class="skill skill-level-100">CSS</div>
<div class="skill skill-level-70">HTML</div>
<div class="skill skill-level-40">PHP</div>
</div>
You can optimize with CSS variables:
.skill-container .skill {
color: white;
background-color: lightgray;
margin: 5px 0;
padding: 10px 0 10px 4px;
overflow: hidden;
border-radius: 5px;
white-space: nowrap;
position: relative;
z-index:0;
}
.skill-container .skill::before {
content: "";
position: absolute;
background-color: #312E81;
border-radius: inherit;
z-index: -1;
top: 0;
bottom: 0;
left: 0;
width:var(--l,0%);
animation: animateLeft 1s ease-out;
}
#keyframes animateLeft {
from {
transform: translateX(-100%);
}
}
<div class="skill-container">
<div class="skill" style="--l:100%">CSS</div>
<div class="skill" style="--l:70%">HTML</div>
<div class="skill" style="--l:40%">PHP</div>
</div>

Page scrolling even when there's no content

My web page is scrolling to the right even though there's no content there and there's just empty white space there. The content isn't over 100vw and if I reduce it, then it doesn't fill the page.
Perhaps some of the CSS I've written has caused this? What do I need to change/add to my code to fix this? Thanks.
Home.css
#wrapper {padding: 0; margin: 0; box-sizing: border-box;}
.section
{
padding: 0 20px 20px 20px;
width: 100vw;
display: flex;
flex-direction: column;
text-align: justify;
top: -110px;
left: -230px;
height: 100vh;
justify-content: center;
align-items: center;
position: relative;
background-image: url(../images/background.jpg);
background-position: center;
background-size: cover;
}
h1 {
color: white;
font-size: 70px;
margin-top: 40px;
z-index: 1;
position: relative;
}
.section:after {
content: '';
width: 100%;
height: 100%;
left: 0;
position: absolute;
background: rgba(214, 87, 214, 0.03);
}
.name {
font-family: 'Amatic SC', cursive;
font-size: 62px;
margin-top: 90px;
animation-name: slideInLeft;
animation-duration: 4s;
animation-timing-function: ease-in;
}
#keyframes slideInLeft {
0% {margin-left: -1600px;}
100% {margin-left: 0px;}
}
.role {
animation-name: slideInRight;
animation-duration: 4s;
animation-timing-function: ease-in;
}
#keyframes slideInRight {
0% {margin-right: -1600px;}
100% {margin-right: 0px;}
}
/* width */
::-webkit-scrollbar {
width: 20px;
}
/* Track */
::-webkit-scrollbar-track {
background: #ffffff;
}
::-webkit-scrollbar-thumb {
background: rgb(155, 12, 48) ;
background: radial-gradient(circle, rgb(155, 12, 48) 0%, rgb(63, 2, 87) 100%);
border-radius: 0.6em;
height: 22px;
}
.name {
color: rgb(231, 139, 139);
}
App.css
:root {
--off-white: #fafafa;
}
.nav {
background-color: var(--off-white);
position: sticky;
top: 0px;
width: 100%;
height: 80px;
z-index: 1000;
box-shadow: 0 4px 14px 0 rgba(0, 0, 0, 0.15);
}
.nav-btn {
height: 60px;
width: 60px;
}
.nav .nav-content {
max-width: 900px;
padding: 0rem 3rem;
margin: 0 auto;
display: flex;
justify-content: space-between;
align-items: center;
height: 100%;
}
.nav-item {
display: inline;
top: 40px;
margin-left: 2rem;
color: white;
font-size: 18px;
z-index: 1;
position: relative;
}
.nav-item:hover {
color: black;
cursor: pointer;
}
.section-content {
max-width: 800px;
margin: 0 auto;
padding: 40px;
}
Have you tried the overflow property,
{
overflow:hidden
}
it's kinda hard to analyze it without HTML code.
But maybe that line is your problem:
.section
{
..
left: -230px;
..
}

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.