This question already has answers here:
Footer at bottom of page or content, whichever is lower
(5 answers)
Closed 11 months ago.
I have a HTML. And i want to add the Footer to it but it is not aligning to it's bottom.
#import url(https://fonts.googleapis.com/css?family=Gudea:400,700);
#import url(https://fonts.googleapis.com/css2?family=Poppins:wght#200;300;400;500;600;700&display=swap);
#import url(https://fonts.googleapis.com/css2?family=Poppins:wght#100;200;300;400;500;600;700;800;900&display=swap);
#import url(https://fonts.googleapis.com/css2?family=Balsamiq+Sans:wght#400;700&family=Mochiy+Pop+P+One&display=swap);
:root {
--dark-one: #333;
--dark-two: #7a7a7a;
--main-color: #784cfb;
--light-one: #fff;
--light-two: #f9fafb;
--light-three: #f6f7fb;
--color_one: #ee1d52;
--color_two: #69c9d0;
--color_three: rgba(2, 0, 36, 1);
--gradient: linear-gradient(90deg, var(--color_three) 0%, var(--color_one) 35%, var(--color_three) 100%)
}
body {
perspective: 800px;
height: 100vh;
margin: 0;
overflow: hidden;
font-family: "Gudea", sans-serif;
background: #ea5c54;
background: -moz-linear-gradient(-45deg, #ea5c54 0%, #bb6dec 100%);
background: -webkit-gradient(linear, left top, right bottom, color-stop(0%, #ea5c54), color-stop(100%, #bb6dec));
background: -webkit-linear-gradient(-45deg, #ea5c54 0%, #bb6dec 100%);
background: -o-linear-gradient(-45deg, #ea5c54 0%, #bb6dec 100%);
background: -ms-linear-gradient(-45deg, #ea5c54 0%, #bb6dec 100%);
background: linear-gradient(135deg, #ea5c54 0%, #bb6dec 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#EA5C54 ', endColorstr='#bb6dec', GradientType=1);
}
body ::-webkit-input-placeholder {
color: #4e546d
}
body .authent {
display: none;
background: #35394a;
background: -moz-linear-gradient(45deg, #35394a 0%, #1f222e 100%);
background: -webkit-gradient(linear, left bottom, right top, color-stop(0%, #35394a), color-stop(100%, #1f222e));
background: -webkit-linear-gradient(45deg, #35394a 0%, #1f222e 100%);
background: -o-linear-gradient(45deg, #35394a 0%, #1f222e 100%);
background: -ms-linear-gradient(45deg, #35394a 0%, #1f222e 100%);
background: linear-gradient(45deg, #35394a 0%, #1f222e 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#35394a', endColorstr='#1f222e', GradientType=1);
position: absolute;
left: 0;
right: 90px;
margin: auto;
width: 100px;
color: white;
text-transform: uppercase;
letter-spacing: 1px;
text-align: center;
padding: 20px 70px;
top: 200px;
bottom: 0;
height: 70px;
opacity: 0
}
body .authent p {
text-align: center;
color: white
}
body .success {
display: none;
color: #d5d8e2;
margin: 40px auto;
align-items: center;
text-align: center
}
body .success p {
font-size: 14px
}
body p {
color: #5b5e6f;
font-size: 10px;
text-align: left
}
body .testtwo {
left: -320px!important
}
body .test {
box-shadow: 0px 20px 30px 3px rgba(0, 0, 0, 0.55);
pointer-events: none;
top: -100px!important;
transform: rotateX(70deg) scale(0.8)!important;
opacity: 0.6!important;
filter: blur(1px)
}
body .login {
opacity: 1;
z-index: -1;
top: 20px;
height: 300px;
width: 240px;
-webkit-transition-timing-function: cubic-bezier(0.68, -0.25, 0.265, 0.85);
transition-property: transform, opacity, box-shadow, top, left;
transition-duration: 0.5s;
transform-origin: 161px 100%;
transform: rotateX(0deg);
position: relative;
border-top: 2px solid #d8312a;
position: absolute;
left: 0;
right: 0;
margin: auto;
top: 0;
bottom: 0;
padding: 100px 40px 40px 40px;
background: #35394a;
background: -moz-linear-gradient(45deg, #35394a 0%, #1f222e 100%);
background: -webkit-gradient(linear, left bottom, right top, color-stop(0%, #35394a), color-stop(100%, #1f222e));
background: -webkit-linear-gradient(45deg, #35394a 0%, #1f222e 100%);
background: -o-linear-gradient(45deg, #35394a 0%, #1f222e 100%);
background: -ms-linear-gradient(45deg, #35394a 0%, #1f222e 100%);
background: linear-gradient(45deg, #35394a 0%, #1f222e 100%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#35394a', endColorstr='#1f222e', GradientType=1)
}
body .login .validation {
position: absolute;
z-index: 1;
right: 10px;
top: 6px;
opacity: 0
}
body .login .disclaimer {
position: absolute;
bottom: 20px;
left: 35px;
width: 250px
}
body .login_title {
color: #afb1be;
height: 60px;
text-align: left;
font-size: 16px
}
body .login_fields {
height: 208px;
position: absolute;
left: 0
}
body .login_fields .icon {
position: absolute;
z-index: 1;
left: 36px;
top: 8px;
opacity: 0.5
}
body .login_fields input[type="password"] {
color: #dc6180!important
}
body .login_fields input[type="text"],
body .login_fields input[type="password"] {
color: #afb1be;
width: 190px;
margin-top: -2px;
background: #32364a;
left: 0;
padding: 10px 65px;
border-top: 2px solid #393d52;
border-bottom: 2px solid #393d52;
border-right: none;
border-left: none;
outline: none;
font-family: "Gudea", sans-serif;
box-shadow: none
}
body .login_fields__user,
body .login_fields__password {
position: relative
}
body .login_fields__submit {
position: relative;
top: 35px;
left: 0;
width: 80%;
right: 0;
margin: auto
}
body .login_fields__submit .forgot {
float: right;
font-size: 10px;
margin-top: 11px;
text-decoration: underline
}
body .login_fields__submit .forgot a {
color: #606479
}
body .login_fields__submit input {
border-radius: 50px;
background: transparent;
padding: 10px 50px;
border: 2px solid #dc6180;
color: #dc6180;
text-transform: uppercase;
font-size: 11px;
transition-property: background, color;
transition-duration: 0.2s
}
body .login_fields__submit input:focus {
box-shadow: none;
outline: none
}
body .login_fields__submit input:hover {
color: white;
background: #dc6180;
cursor: pointer;
transition-property: background, color;
transition-duration: 0.2s
}
.love {
position: absolute;
right: 20px;
bottom: 0px;
font-size: 11px;
font-weight: normal
}
.love p {
color: white;
font-weight: normal;
font-family: "Open Sans", sans-serif
}
.love a {
color: white;
font-weight: 700;
text-decoration: none
}
.love img {
position: relative;
top: 3px;
margin: 0px 4px;
width: 10px
}
.brand {
position: absolute;
left: 20px;
bottom: 14px
}
.brand img {
width: 30px
}
h1 {
position: relative;
text-align: center;
color: #353535;
font-size: 50px;
font-family: "Cormorant Garamond", serif
}
p {
font-family: "Lato", sans-serif;
font-weight: 300;
text-align: center;
font-size: 18px;
color: #676767
}
.frame {
width: 90%;
margin: 40px auto;
text-align: center
}
.thumb_img {
max-width: 110%;
margin-left: -14px;
margin-top: -54px
}
button {
margin: 20px
}
.custom-btn {
width: 130px;
height: 40px;
color: #fff;
border-radius: 5px;
padding: 10px 25px;
font-family: "Lato", sans-serif;
font-weight: 500;
background: transparent;
cursor: pointer;
transition: all 0.3s ease;
position: relative;
display: inline-block;
box-shadow: inset 2px 2px 2px 0px rgba(255, 255, 255, 0.5), 7px 7px 20px 0px rgba(0, 0, 0, 0.1), 4px 4px 5px 0px rgba(0, 0, 0, 0.1);
outline: none
}
.btn {
border: none;
background: rgb(251, 33, 117);
background: linear-gradient(0deg, rgba(251, 33, 117, 1) 0%, rgba(234, 76, 137, 1) 100%);
color: #fff;
overflow: hidden;
margin: auto;
margin-top: 10px
}
.btn:hover {
text-decoration: none;
color: #fff
}
.btn:before {
position: absolute;
content: "";
display: inline-block;
top: -180px;
left: 0;
width: 30px;
height: 100%;
background-color: #fff;
animation: shiny-btn1 3s ease-in-out infinite
}
.btn:hover {
opacity: 0.7
}
.btn:active {
box-shadow: 4px 4px 6px 0 rgba(255, 255, 255, 0.3), -4px -4px 6px 0 rgba(116, 125, 136, 0.2), inset -4px -4px 6px 0 rgba(255, 255, 255, 0.2), inset 4px 4px 6px 0 rgba(0, 0, 0, 0.2)
}
#-webkit-keyframes shiny-btn1 {
0% {
-webkit-transform: scale(0) rotate(45deg);
opacity: 0
}
80% {
-webkit-transform: scale(0) rotate(45deg);
opacity: 0.5
}
81% {
-webkit-transform: scale(4) rotate(45deg);
opacity: 1
}
100% {
-webkit-transform: scale(50) rotate(45deg);
opacity: 0
}
}
#context-menu {
position: absolute;
height: auto;
display: block;
top: 10%;
left: 40%;
border-radius: 5px;
width: 200px
}
ul {
list-style-type: none
}
li.menu-items {
height: 50px;
margin-top: 7px;
background-color: #fff;
box-shadow: 0 2px 20px 2px #22222225;
width: 100%;
border-radius: 4px;
font-size: 20px;
color: #444;
line-height: 50px;
vertical-align: middle;
padding-left: 15px;
cursor: pointer;
transition: all 0.1s ease-in;
transform-origin: top left;
transform: rotateY(90deg) rotateX(45deg)
}
li.menu-items:nth-child(1) {
transition: transform 0.25s 0s cubic-bezier(0, 0.36, 0.95, -0.2), background-color 0.15s ease-in
}
li.menu-items:nth-child(2) {
transition: transform 0.25s 0.15s cubic-bezier(0, 0.36, 0.95, -0.2), background-color 0.15s ease-in
}
li.menu-items:nth-child(3) {
transition: transform 0.25s 0.3s cubic-bezier(0, 0.36, 0.95, -0.2), background-color 0.15s ease-in
}
li.menu-items:nth-child(4) {
transition: transform 0.25s 0.45s cubic-bezier(0, 0.36, 0.95, -0.2), background-color 0.15s ease-in
}
li.menu-items:hover {
background-color: coral;
color: #fff;
transform: perspective(10px)
}
a img {
border: 0
}
h1 {
font: bold 32px Helvetica, Arial, Sans-Serif;
letter-spacing: -1px;
margin: 50px 0 20px 0
}
p {
margin: 0 0 20px 0
}
.close-icon:hover {
background: #efefef
}
*,
*::before,
*::after {
margin: 0;
padding: 0
}
html {
scroll-behavior: smooth
}
#header {
font-family: "Poppins", sans-serif
}
#header a {
text-decoration: none
}
#header ul {
list-style: none
}
#header img {
width: 100%
}
#header .container {
position: relative;
z-index: 5;
max-width: 92rem;
padding: 0 4rem;
margin: 0 auto
}
.stop-scrolling {
height: 150%;
overflow: hidden
}
#header .grid-2 {
display: grid;
grid-template-columns: repeat(2, 1fr);
align-items: center;
justify-content: center
}
#header .text {
font-size: 1.25rem;
color: var(--dark-two);
line-height: 1.6
}
.column-1 {
margin-right: 1.5rem
}
.column-2 {
margin-left: 1.5rem
}
#header .image {
position: relative;
display: flex;
align-items: center;
justify-content: center
}
.z-index {
position: relative;
z-index: 2
}
#header .overlay {
position: absolute;
width: 100%;
height: 100%;
overflow: hidden;
top: 0;
left: 0
}
#header .overlay .shape {
width: initial;
opacity: 0.13;
position: absolute
}
#header .overlay.overlay-lg .shape {
height: 55px
}
#header .overlay.overlay-lg .shape.wave {
height: initial;
width: 88px
}
#header .overlay.overlay-lg .shape.xshape {
height: 38px
}
#header .overlay.overlay-sm .shape {
filter: brightness(0) invert(1);
opacity: 0.15;
height: 40px
}
#header .overlay.overlay-sm .shape.wave {
height: initial;
width: 70px
}
#header .overlay.overlay-sm .shape.xshape {
height: 30px
}
#header .points {
opacity: 0.3;
position: absolute
}
#header .section {
padding: 7rem 0;
overflow: hidden
}
.section-header {
text-align: center;
margin-bottom: 1.5rem
}
#header .title {
position: relative;
display: inline-block;
padding-bottom: 1rem;
line-height: 1;
font-size: 2.8rem;
margin-bottom: 0.6rem
}
#header .title:before {
content: attr(data-title);
display: block;
margin-bottom: 0.4rem;
color: var(--main-color);
font-size: 1.15rem;
font-weight: 500;
text-transform: uppercase;
letter-spacing: 3px
}
#header .title:after {
content: "";
position: absolute;
width: 90px;
height: 5px;
border-radius: 3px;
background-color: var(--main-color);
bottom: 0;
left: 50%;
transform: translateX(-50%)
}
#header .section-header .text {
max-width: 600px;
margin: 0 auto
}
#header .title-sm {
color: var(--dark-one);
font-weight: 600;
font-size: 1.6rem
}
#header .points-sq {
width: 210px
}
#header .btn {
display: inline-block;
padding: 0.85rem 2rem;
background-color: var(--main-color);
color: var(--light-one);
border-radius: 2rem;
font-size: 1.05rem;
text-transform: uppercase;
font-weight: 500;
transition: 0.3s
}
#header .btn:hover {
background-color: #6b44e0
}
#header .btn.small {
padding: 0.7rem 1.8rem;
font-size: 1rem
}
header {
width: 100%;
background-color: var(--light-three);
overflow: hidden;
position: relative
}
#header nav {
width: 100%;
position: relative;
z-index: 50
}
#header nav .container {
display: flex;
justify-content: space-between;
height: 4.5rem;
align-items: center
}
#header .logo {
width: 65px;
display: flex;
align-items: center
}
.links ul {
display: flex
}
.links a {
display: inline-block;
padding: 0.9rem 1.2rem;
color: var(--dark-one);
font-size: 1.05rem;
text-transform: uppercase;
font-weight: 500;
line-height: 1;
transition: 0.3s
}
.links a.active {
background-color: var(--main-color);
color: var(--light-one);
border-radius: 2rem;
font-size: 1rem;
padding: 0.9rem 2.1rem;
margin-left: 1rem
}
.links a:hover {
color: var(--main-color)
}
.links a.active:hover {
color: var(--light-one);
background-color: #6b44e0
}
.hamburger-menu {
width: 2.7rem;
height: 3rem;
z-index: 100;
position: relative;
display: none;
align-items: center;
justify-content: flex-end
}
.hamburger-menu .bar {
position: relative;
width: 2.1rem;
height: 3px;
border-radius: 3px;
background-color: var(--dark-one);
transition: 0.5s
}
.bar:before,
.bar:after {
content: "";
position: absolute;
width: 2.1rem;
height: 3px;
border-radius: 3px;
background-color: var(--dark-one);
transition: 0.5s
}
.bar:before {
transform: translateY(-9px)
}
.bar:after {
transform: translateY(9px)
}
nav.open .hamburger-menu .bar {
background-color: transparent;
transform: rotate(360deg)
}
nav.open .hamburger-menu .bar:before {
transform: translateY(0) rotate(45deg);
background-color: var(--light-one)
}
nav.open .hamburger-menu .bar:after {
transform: translateY(0) rotate(-45deg);
background-color: var(--light-one)
}
nav.open .links {
transform: translateX(0)
}
.header-content .container.grid-2 {
grid-template-columns: 2.5fr 3.5fr;
min-height: calc(100vh - 6rem);
padding-bottom: 2.5rem;
text-align: left
}
.header-title {
font-size: 3.8rem;
line-height: 0.8;
color: var(--dark-one)
}
.header-content .text {
margin: 2.15rem 0
}
.header-content .image .img-element {
max-width: 750px
}
header .points1 {
width: 420px;
bottom: -75px;
left: -150px
}
header .points2 {
width: 70%;
top: 65%;
left: 71%
}
header .square {
right: 68%;
top: 71%
}
header .triangle {
right: 7%;
bottom: 75%
}
header .xshape {
right: 4%;
bottom: 50%
}
header .half-circle1 {
left: 50%;
bottom: 82%
}
header .half-circle2 {
left: 5%;
top: 67%
}
header .wave1 {
bottom: 75%;
left: 20%
}
header .wave2 {
bottom: 8%;
right: 55%
}
header .circle {
left: 38%;
bottom: 63%
}
.letters {
position: absolute;
width: 13.5%;
top: -5px;
left: 15px;
opacity: 0.06
}
#media (max-width:1280px) {
.overlay.overlay-lg .shape {
height: 35px
}
.overlay.overlay-lg .shape.wave {
height: initial;
width: 63px
}
.overlay.overlay-lg .shape.xshape {
height: 24px
}
header .points1 {
width: 270px;
bottom: -50px;
left: -75px
}
header .letters {
width: 11%
}
nav .container {
height: 4.5rem
}
.logo {
width: 65px
}
.links a {
font-size: 0.8rem;
padding: 0.65rem 0.7rem
}
.links a.active {
font-size: 0.7rem;
padding: 0.7rem 1.7rem;
margin-left: 0.6rem
}
}
#media (max-width:425px) {
.connection-wrapper .toast {
width: 300px
}
}
#media (max-width:850px) {
.hamburger-menu {
display: flex;
margin-right: -2rem
}
#header img {
margin-left: -3rem
}
.links {
position: fixed;
width: 100%;
height: 100vh;
top: 0;
right: 0;
background-color: #252525;
display: none;
align-items: center;
justify-content: center;
text-align: center;
transform: translateX(100%);
transition: 0.5s
}
.links ul {
flex-direction: column
}
.links a {
color: var(--light-one)
}
.links a.active {
margin-left: 0;
margin: 0.5rem 0
}
.letters,
header .half-circle2,
header .points1,
header .wave2 {
display: none
}
header .half-circle1 {
bottom: 55%;
left: 23%
}
header .circle {
left: 8%;
bottom: 40%
}
header .wave1 {
bottom: 87%;
left: 75%
}
header .square {
top: initial;
bottom: 5%;
left: 13%
}
header .triangle {
right: 14%;
bottom: 63%
}
header .xshape {
left: 90%;
top: 54%
}
}
#media (max-width:560px) {
.container {
padding: 0 2rem
}
.overlay.overlay-lg .shape {
height: 28px
}
.overlay.overlay-lg .shape.wave {
height: initial;
width: 52px
}
.overlay.overlay-lg .shape.xshape {
height: 22px
}
}
footer {
bottom: 0;
color: #14171a;
font-family: "Balsamiq Sans", sans-serif
}
footer a,
footer a:hover {
text-decoration: none;
color: inherit
}
.page-footer {
margin-top: 35px;
border-top: 1px solid #e6e5e6
}
.primary-footer {
padding: 36px 0!important;
background-color: #f2f3f5;
color: #666;
font-size: 14px;
line-height: 24px
}
.primary-footer ul {
margin: 0;
padding: 0;
list-style-type: none
}
.primary-footer .copyright {
margin-bottom: 0
}
.primary-footer ul li {
display: inline-block;
margin-right: 16px
}
.primary-footer a {
color: #737373;
font-weight: 600
}
.primary-footer .dislaimer {
border-top: 1px solid #e4e2e4;
margin: 23px 0 0;
padding-top: 23px;
font-weight: 300
}
.primary-footer a {
color: #737373;
font-weight: 600;
transition: color 0s ease-in-out
}
.primary-footer .dislaimer a {
font-weight: 300;
transition: all 0s ease
}
.primary-footer a:hover {
text-decoration: none;
color: var(--hover)
}
#media only screen and (max-width:767px) {
.primary-footer .copyright {
width: 100%;
text-align: center;
margin-top: 12px
}
.primary-footer ul {
text-align: center;
width: 100%
}
}
footer .flex {
display: flex
}
footer .flex-wrap {
flex-wrap: wrap
}
footer .justify-content-between {
justify-content: space-between
}
footer .align-items-center {
align-items: center
}
footer .text-center {
text-align: center
}
footer .position-relative {
position: relative
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
<title>Download Now</title>
<link href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/themes/smoothness/jquery-ui.css" rel="stylesheet" />
<link href="https://unicons.iconscout.com/release/v3.0.6/css/line.css" rel="stylesheet" />
</head>
<body>
<header id="header">
<nav>
<div class="container">
<div class="logo">
<img src="./favicon.ico" alt="" />
</div>
<div class="links">
<ul>
<li>
Why Us?
</li>
<li>
FAQs
</li>
<li>
Stats
</li>
<li>
Support Group
</li>
</ul>
</div>
<div class="hamburger-menu">
<div class="bar"></div>
</div>
</div>
</nav>
</header>
<form id="download_video">
<div class="login">
<div class="login_title"><span>Download Videos Online</span></div>
<input type="hidden" name="sss" value="VideoDownloader" />
<div class="login_fields">
<div class="login_fields__user">
<div class="icon"><img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/217233/user_icon_copy.png" /></div>
<input type="text" id="video" name="video_url" placeholder="Video URL" />
<div class="validation"><img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/217233/tick.png" /></div>
</div>
<div class="login_fields__submit">
<input type="button" id="get_formats" name=jjs " value="Check Link " />
<div class="forgot ">
Supported Websites
</div>
</div>
</div>
<div class="success " id="formats ">
<img class="thumb_img " id="thumb_img " src="image/not-available.png " height="150 " align="middle " />
<br />
<br />
<label for="standard-select ">Select the preferred quality</label>
<select id="standard-select "></select>
</div>
<div class="disclaimer ">
<p>No Porn Allowed</p>
</div>
</div>
</form>
<div id="context-menu " style="display: none; ">
<ul>
<li class="menu-items ">Developer</li>
<li class="menu-items ">Support Group</li>
<li class="menu-items ">Reload</li>
<li class="menu-items ">Source Code</li>
<li class="menu-items ">Inspect</li>
</ul>
</div>
<div class="authent ">
<img src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/217233/puff.svg " />
<p>Checking URL....</p>
</div>
<footer class="page-footer ">
<div class="primary-footer position-relative ">
<div class="container ">
<div class="flex flex-wrap justify-content-between align-items-center ">
<ul>
<li><a title="About " href="/about-us ">About</a></li>
<li><a title="Privacy Policy " href="/privacy-policy ">Privacy Policy</a></li>
<li><a title="Terms of Service " href="/terms ">Terms of Service</a></li>
<li><a title="Contact Us " href="/contact-us ">Contact Us</a></li>
</ul>
<p class="copyright ">Copyright © 2022 All rights reserved.</p>
</div>
<p class="dislaimer text-center ">
Disclaimer:- <a title="WeSing Downloader " href="/ ">DLNow.ml</a>
is Not associated with Any Supported Sites in any ways and DLNow.ml does not host any of the video or audio on our servers, and all videos or audio that you download from our tool are downloaded from their respective
CDN servers.
</p>
</div>
</div>
</footer>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js "></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js "></script>
<script src="static/js/index.js "></script>
</body>
</html>
But in it my Footer is not aligning to the bottom of the page...
I have tried setting position: absolute; but it work but it is covering the main content.
I also tried setting the bottom: 0; but it was also found not to be working.
So, kindly help me to get out of it...
Original Look
Look with absolute position
https://i.stack.imgur.com/43z0u.jpg
https://i.stack.imgur.com/nNHE2.jpg
UPDATED
I did modify some of your CSS, you can check it out here
https://jsfiddle.net/wmLvqyj4/3/
For the mobile's screen size, it's too small for your form but tablet and desktop's are good
OLD ANSWER
I cannot run your CSS properly but can suggest you to do this way https://jsfiddle.net/479dnqy2/1/
Usually, a page footer is a static content, so we briefly know its height. You can set your page content's height with this formula your content height = full page height - footer height
.page-content {
min-height: calc(100vh - 10rem); /*10rem is the size of footer*/
}
.page-footer {
height: 10rem; /*the fixed height of the footer*/
}
How about this?
footer {
position: fixed;
bottom: 0;
}
or
footer {
position: absolute;
bottom: 0;
width: 100%;
height: 2.5rem; /* Footer height */
}
Related
I am not able to run my code and produce an image under header 2
Are there any reason why as I have already input the right code.
I believe another css layout is blocking the image from popping out. Below here is the code to check
<div class="login-box">
<h2>Login</h2>
<form>
<div class="user-box">
<input type="text" name="" required="">
<label>Username</label>
</div>
<div class="user-box">
<input type="password" name="" required="">
<label>Password</label>
</div>
<a href="#">
<span></span>
<span></span>
<span></span>
<span></span>
Submit
</a>
</form>
</div>
<div class="section-container">
<h2 class="title-container">Here are my other socials you can find me on
</h2>
<img src="//placekitten.com/150/150" alt="">Image
</div>
My CSS below
html {
height: 100%;
}
body {
margin:0;
padding:0;
font-family: sans-serif;
background: linear-gradient(#141e30, #243b55);
}
.login-box {
position: absolute;
top: 78%;
left: 50%;
width: 400px;
padding: 30px;
transform: translate(-50% , -50%);
background: rgba(0,0,0,.5);
box-sizing: border-box;
box-shadow: 0 15px 25px rgba(0,0,0,.6);
border-radius: 20px;
}
.login-box h2 {
margin: 0 0 30px;
padding: 0;
color: #fff;
text-align: center;
}
.login-box .user-box {
position: relative;
}
.login-box .user-box input {
width: 100%;
padding: 10px 0;
font-size: 16px;
color: #fff;
margin-bottom: 30px;
border: none;
border-bottom: 1px solid #fff;
outline: none;
background: transparent;
}
.login-box .user-box label {
position: absolute;
top:0;
left: 0;
padding: 10px 0;
font-size: 16px;
color: #fff;
pointer-events: none;
transition: .5s;
}
.login-box .user-box input:focus ~ label,
.login-box .user-box input:valid ~ label {
top: -20px;
left: 0;
color: #03e9f4;
font-size: 12px;
}
.login-box form a {
position: relative;
display: inline-block;
padding: 10px 20px;
color: #03e9f4;
font-size: 16px;
text-decoration: none;
text-transform: uppercase;
overflow: hidden;
transition: .5s;
margin-top: 40px;
letter-spacing: 4px
}
.login-box a:hover {
background: #03e9f4;
color: #fff;
border-radius: 5px;
box-shadow: 0 0 5px #03e9f4,
0 0 25px #03e9f4,
0 0 50px #03e9f4,
0 0 100px #03e9f4;
}
.login-box a span {
position: absolute;
display: block;
}
.login-box a span:nth-child(1) {
top: 0;
left: -100%;
width: 100%;
height: 2px;
background: linear-gradient(90deg, transparent, #03e9f4);
animation: btn-anim1 1s linear infinite;
}
#keyframes btn-anim1 {
0% {
left: -100%;
}
50%,100% {
left: 100%;
}
}
.login-box a span:nth-child(2) {
top: -100%;
right: 0;
width: 2px;
height: 100%;
background: linear-gradient(180deg, transparent, #03e9f4);
animation: btn-anim2 1s linear infinite;
animation-delay: .25s
}
#keyframes btn-anim2 {
0% {
top: -100%;
}
50%,100% {
top: 100%;
}
}
.login-box a span:nth-child(3) {
bottom: 0;
right: -100%;
width: 100%;
height: 2px;
background: linear-gradient(270deg, transparent, #03e9f4);
animation: btn-anim3 1s linear infinite;
animation-delay: .5s
}
#keyframes btn-anim3 {
0% {
right: -100%;
}
50%,100% {
right: 100%;
}
}
.login-box a span:nth-child(4) {
bottom: -100%;
left: 0;
width: 2px;
height: 100%;
background: linear-gradient(360deg, transparent, #03e9f4);
animation: btn-anim4 1s linear infinite;
animation-delay: .75s
}
#keyframes btn-anim4 {
0% {
bottom: -100%;
}
50%,100% {
bottom: 100%;
}
}
.section-container {
display: flex;
flex-direction: column;
justify-content: flex-start;
text-align: left;
width: 100%;
background-image: linear-gradient( 60deg, rgba(57, 60, 90, 0.85), rgba(180, 180, 120, 0.5) );
background-position: center;
background-size: cover;
font-weight: bold;
text-shadow: rgb(56, 50, 50) 1px 1px
}
.title-container {
display: block;
color: white;
text-shadow: 2px 2px black;
width: 40%;
padding: 30px;
margin-bottom: 20%;
margin-right: 50px;
border-top: 1px black solid;
}
I tried to put the img code under . but did not get the image to pop up under the h2 tag
html {
height: 100%;
}
body {
margin:0;
padding:0;
font-family: sans-serif;
background: linear-gradient(#141e30, #243b55);
}
.login-box {
position: absolute;
top: 78%;
left: 50%;
width: 400px;
padding: 30px;
transform: translate(-50% , -50%);
background: rgba(0,0,0,.5);
box-sizing: border-box;
box-shadow: 0 15px 25px rgba(0,0,0,.6);
border-radius: 20px;
}
.login-box h2 {
margin: 0 0 30px;
padding: 0;
color: #fff;
text-align: center;
}
.login-box .user-box {
position: relative;
}
.login-box .user-box input {
width: 100%;
padding: 10px 0;
font-size: 16px;
color: #fff;
margin-bottom: 30px;
border: none;
border-bottom: 1px solid #fff;
outline: none;
background: transparent;
}
.login-box .user-box label {
position: absolute;
top:0;
left: 0;
padding: 10px 0;
font-size: 16px;
color: #fff;
pointer-events: none;
transition: .5s;
}
.login-box .user-box input:focus ~ label,
.login-box .user-box input:valid ~ label {
top: -20px;
left: 0;
color: #03e9f4;
font-size: 12px;
}
.login-box form a {
position: relative;
display: inline-block;
padding: 10px 20px;
color: #03e9f4;
font-size: 16px;
text-decoration: none;
text-transform: uppercase;
overflow: hidden;
transition: .5s;
margin-top: 40px;
letter-spacing: 4px
}
.login-box a:hover {
background: #03e9f4;
color: #fff;
border-radius: 5px;
box-shadow: 0 0 5px #03e9f4,
0 0 25px #03e9f4,
0 0 50px #03e9f4,
0 0 100px #03e9f4;
}
.login-box a span {
position: absolute;
display: block;
}
.login-box a span:nth-child(1) {
top: 0;
left: -100%;
width: 100%;
height: 2px;
background: linear-gradient(90deg, transparent, #03e9f4);
animation: btn-anim1 1s linear infinite;
}
#keyframes btn-anim1 {
0% {
left: -100%;
}
50%,100% {
left: 100%;
}
}
.login-box a span:nth-child(2) {
top: -100%;
right: 0;
width: 2px;
height: 100%;
background: linear-gradient(180deg, transparent, #03e9f4);
animation: btn-anim2 1s linear infinite;
animation-delay: .25s
}
#keyframes btn-anim2 {
0% {
top: -100%;
}
50%,100% {
top: 100%;
}
}
.login-box a span:nth-child(3) {
bottom: 0;
right: -100%;
width: 100%;
height: 2px;
background: linear-gradient(270deg, transparent, #03e9f4);
animation: btn-anim3 1s linear infinite;
animation-delay: .5s
}
#keyframes btn-anim3 {
0% {
right: -100%;
}
50%,100% {
right: 100%;
}
}
.login-box a span:nth-child(4) {
bottom: -100%;
left: 0;
width: 2px;
height: 100%;
background: linear-gradient(360deg, transparent, #03e9f4);
animation: btn-anim4 1s linear infinite;
animation-delay: .75s
}
#keyframes btn-anim4 {
0% {
bottom: -100%;
}
50%,100% {
bottom: 100%;
}
}
.section-container {
display: flex;
flex-direction: column;
justify-content: flex-start;
text-align: left;
width: 100%;
background-image: linear-gradient( 60deg, rgba(57, 60, 90, 0.85), rgba(180, 180, 120, 0.5) );
background-position: center;
background-size: cover;
font-weight: bold;
text-shadow: rgb(56, 50, 50) 1px 1px
}
.title-container {
display: block;
color: white;
text-shadow: 2px 2px black;
width: 40%;
padding: 30px;
margin-bottom: 20%;
margin-right: 50px;
border-top: 1px black solid;
}
<div class="login-box">
<h2>Login</h2>
<form>
<div class="user-box">
<input type="text" name="" required="">
<label>Username</label>
</div>
<div class="user-box">
<input type="password" name="" required="">
<label>Password</label>
</div>
<a href="#">
<span></span>
<span></span>
<span></span>
<span></span>
Submit
</a>
</form>
</div>
<div class="section-container">
<h2 class="title-container">Here are my other socials you can find me on
</h2>
<img src="https://placekitten.com/150/150" alt="">Image
</div>
Not a css issue. You don't have the correct path to the image. I've inserted the correct path.
The margin on the heading element is causing this.
Instead of adding the img element, consider adding the image as a background to another element...
CSS added:
body {
background: url("//placekitten.com/150/150");
background-repeat: no-repeat;
background-size: cover;
}
Below I have added it to the body, but this could be done to any element of your choosing really.
html {
height: 100%;
}
body {
margin: 0;
padding: 0;
font-family: sans-serif;
background: linear-gradient(#141e30, #243b55);
}
.login-box {
position: absolute;
top: 78%;
left: 50%;
width: 400px;
padding: 30px;
transform: translate(-50%, -50%);
background: rgba(0, 0, 0, .5);
box-sizing: border-box;
box-shadow: 0 15px 25px rgba(0, 0, 0, .6);
border-radius: 20px;
}
.login-box h2 {
margin: 0 0 30px;
padding: 0;
color: #fff;
text-align: center;
}
.login-box .user-box {
position: relative;
}
.login-box .user-box input {
width: 100%;
padding: 10px 0;
font-size: 16px;
color: #fff;
margin-bottom: 30px;
border: none;
border-bottom: 1px solid #fff;
outline: none;
background: transparent;
}
.login-box .user-box label {
position: absolute;
top: 0;
left: 0;
padding: 10px 0;
font-size: 16px;
color: #fff;
pointer-events: none;
transition: .5s;
}
.login-box .user-box input:focus~label,
.login-box .user-box input:valid~label {
top: -20px;
left: 0;
color: #03e9f4;
font-size: 12px;
}
.login-box form a {
position: relative;
display: inline-block;
padding: 10px 20px;
color: #03e9f4;
font-size: 16px;
text-decoration: none;
text-transform: uppercase;
overflow: hidden;
transition: .5s;
margin-top: 40px;
letter-spacing: 4px
}
.login-box a:hover {
background: #03e9f4;
color: #fff;
border-radius: 5px;
box-shadow: 0 0 5px #03e9f4, 0 0 25px #03e9f4, 0 0 50px #03e9f4, 0 0 100px #03e9f4;
}
.login-box a span {
position: absolute;
display: block;
}
.login-box a span:nth-child(1) {
top: 0;
left: -100%;
width: 100%;
height: 2px;
background: linear-gradient(90deg, transparent, #03e9f4);
animation: btn-anim1 1s linear infinite;
}
#keyframes btn-anim1 {
0% {
left: -100%;
}
50%,
100% {
left: 100%;
}
}
.login-box a span:nth-child(2) {
top: -100%;
right: 0;
width: 2px;
height: 100%;
background: linear-gradient(180deg, transparent, #03e9f4);
animation: btn-anim2 1s linear infinite;
animation-delay: .25s
}
#keyframes btn-anim2 {
0% {
top: -100%;
}
50%,
100% {
top: 100%;
}
}
.login-box a span:nth-child(3) {
bottom: 0;
right: -100%;
width: 100%;
height: 2px;
background: linear-gradient(270deg, transparent, #03e9f4);
animation: btn-anim3 1s linear infinite;
animation-delay: .5s
}
#keyframes btn-anim3 {
0% {
right: -100%;
}
50%,
100% {
right: 100%;
}
}
.login-box a span:nth-child(4) {
bottom: -100%;
left: 0;
width: 2px;
height: 100%;
background: linear-gradient(360deg, transparent, #03e9f4);
animation: btn-anim4 1s linear infinite;
animation-delay: .75s
}
#keyframes btn-anim4 {
0% {
bottom: -100%;
}
50%,
100% {
bottom: 100%;
}
}
.section-container {
display: flex;
flex-direction: column;
justify-content: flex-start;
text-align: left;
width: 100%;
background-image: linear-gradient( 60deg, rgba(57, 60, 90, 0.85), rgba(180, 180, 120, 0.5));
background-position: center;
background-size: cover;
font-weight: bold;
text-shadow: rgb(56, 50, 50) 1px 1px
}
.title-container {
display: block;
color: white;
text-shadow: 2px 2px black;
width: 40%;
padding: 30px;
margin-bottom: 20%;
margin-right: 50px;
border-top: 1px black solid;
}
body {
background: url("//placekitten.com/150/150");
background-repeat: no-repeat;
background-size: cover;
}
<div class="login-box">
<h2>Login</h2>
<form>
<div class="user-box">
<input type="text" name="" required="">
<label>Username</label>
</div>
<div class="user-box">
<input type="password" name="" required="">
<label>Password</label>
</div>
<a href="#">
<span></span>
<span></span>
<span></span>
<span></span> Submit
</a>
</form>
</div>
<div class="section-container">
<h2 class="title-container">Here are my other socials you can find me on
</h2>
</div>
So I want to make a radar like a sonar. So I will get a variable from an MQTT subscription. So on this radar, if it outputs 180 degrees and 50 on the distance I want it to be there on the radar. Also when the sweep has registered 180 degrees and 50 on the distance I want for example a red dot to pop up and then when the sweep passed it will fade away and then maybe pop up somewhere else if the variable has changed. How will I be able to do this and what language do I need to use. Like this one but I want the red dots on it that is controlled by MQTT variables. This is the code for the radar and the sweep.
html {
padding: 0;
margin: 0;
--green: rgb(40, 133, 40);
--size: 500px;
}
body {
background: #232;
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
}
.container {
width: var(--size);
height: var(--size);
position: relative;
user-select: none;
}
.status {
font-family: "Lucida Sans Unicode", "Lucida Grande", "Lucida Sans", Arial,
sans-serif;
font-size: 10px;
font-weight: 400;
letter-spacing: 2px;
text-align: center;
padding: 7px 9px 7px 32px;
color: #777;
position: absolute;
bottom: 7%;
left: -5%;
box-shadow: 0 1px 2px 1px rgba(0, 0, 0, 0.6);
border-radius: 8px 0 0 8px;
}
.status::before,
.status::after {
content: "";
position: absolute;
left: 10px;
top: 50%;
transform: translateY(-50%);
width: 10px;
height: 10px;
border-radius: 50%;
border: 1px solid #333;
background: #181818;
}
.status::after {
background: radial-gradient(var(--green) 60%, darkgreen 40%);
animation: light 1.2s infinite alternate
cubic-bezier(0.785, 0.135, 0.15, 0.86);
border-color: transparent;
box-shadow: 0 0 5px 1px var(--green);
}
#keyframes light {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
.container::after {
content: "";
width: 120%;
height: 100%;
left: -10%;
background: linear-gradient(45deg, #222, #333);
position: absolute;
z-index: -1;
box-shadow: 1px 2px 2px 2px #111;
border-radius: 4%;
}
.circle {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
border: 2px solid darkgreen;
border-radius: 50%;
width: 60%;
height: 60%;
will-change: transform;
}
#keyframes scan {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
.circle-huge {
width: calc(var(--size) * 0.9);
height: calc(var(--size) * 0.9);
border: 4px solid var(--green);
--gradient: black 0%, black 12.35%, var(--green) 12.35%, var(--green) 12.55%,
black 12.56%;
background: repeating-linear-gradient(var(--gradient)),
repeating-linear-gradient(to right, var(--gradient)),
radial-gradient(black 33%, var(--green));
background-blend-mode: screen;
box-shadow: 0 1px 0 4px #222, 0 3px 0 5px #343;
}
.circle-huge::before {
background: linear-gradient(var(--green) 50%, black 50%),
linear-gradient(90deg, black 50%, var(--green) 50%);
background-blend-mode: darken;
position: absolute;
width: 100%;
height: 100%;
content: "";
border-radius: 50%;
will-change: opacity;
animation: scan 5s linear infinite;
opacity: 0.4;
}
.circle-big {
--this-size: calc(var(--size) * 0.7);
width: var(--this-size);
height: var(--this-size);
}
.circle-medium {
--this-size: calc(var(--size) * 0.5);
width: var(--this-size);
height: var(--this-size);
}
.circle-small {
--this-size: calc(var(--size) * 0.3);
width: var(--this-size);
height: var(--this-size);
}
.circle-tiny {
--this-size: calc(var(--size) * 0.15);
width: var(--this-size);
height: var(--this-size);
}
.circle-center {
width: 5%;
height: 5%;
border-color: firebrick;
background: firebrick;
}
.logo {
position: absolute;
top: 24px;
right: -16px;
font-family: Arial, Helvetica, sans-serif;
text-shadow: -1px 0 1px #111;
text-align: center;
}
.logo-first {
font-size: 19px;
letter-spacing: 2px;
color: #666;
border: 1px solid #383838;
border-radius: 4px;
padding: 3px 5px 1px;
}
.logo-second {
letter-spacing: 3px;
font-size: 14px;
color: #555;
margin-top: 2px;
}
.screw {
width: 12px;
height: 12px;
background: #444;
position: absolute;
top: 15px;
left: -35px;
border-radius: 50%;
box-shadow: 0 1px 0 1px #222;
}
.screw:after {
content: "";
width: 2px;
height: 10px;
position: absolute;
top: 1px;
left: 50%;
transform: translateX(-50%) rotate(35deg);
background: #333;
}
.screw:nth-of-type(even):after {
transform: translateX(-50%) rotate(105deg);
}
.screw:nth-of-type(n + 4):after {
transform: translateX(-50%) rotate(80deg);
}
.screw-1 {
left: initial;
right: -35px;
}
.screw-2 {
top: initial;
left: -35px;
bottom: 15px;
}
.screw-3 {
left: initial;
top: initial;
right: -35px;
bottom: 15px;
}
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<title>CodePen - Military Radar System</title>
<link rel="stylesheet" href="./style.css">
</head>
<body>
<!-- partial:index.partial.html -->
<div class="container">
<div class="screw"></div>
<div class="screw screw-1"></div>
<div class="screw screw-2"></div>
<div class="screw screw-3"></div>
<div class="logo">
<div class="logo-first">RADAR</div>
<div class="logo-second">SYSTEM</div>
</div>
<div class="circle circle-huge">
<div class="circle circle-big">
<div class="circle circle-medium">
<div class="circle circle-small">
<div class="circle circle-tiny">
<div class="circle circle-center"></div>
</div>
</div>
</div>
</div>
</div>
<div class="status">SCANNING</div>
</div>
<!-- partial -->
<script src="./script.js"></script>
</body>
</html>
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;
..
}
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 4 years ago.
Improve this question
I had this piece of css/html code that shows 9 pictures. Some of the pictures might be rectangular, and i want them to be displayed in squares like other pictures. What css rules do i need to adjust? The structure of html is in the picture, so is the current css rules.
I had this piece of css/html code that shows 9 pictures. Some of the pictures might be rectangular, and i want them to be displayed in squares like other pictures. What css rules do i need to adjust? The structure of html is in the picture, so is the current css rules.
I had this piece of css/html code that shows 9 pictures. Some of the pictures might be rectangular, and i want them to be displayed in squares like other pictures. What css rules do i need to adjust? The structure of html is in the picture, so is the current css rules.
The code is attached below
#import url("https://fonts.googleapis.com/css?family=Montserrat");
#import url("https://fonts.googleapis.com/css?family=Open+Sans");
body, html {
width: 100%;
height: 100%;
font-family: "Montserrat";
color: #303633;
background-color: #C8D9E7;
overflow: hidden;
font-size: 1em;
font-style: normal;
-webkit-appearance: none;
outline: none;
text-rendering: geometricPrecision;
perspective: 1000px;
}
a {
position: relative;
display: inline-block;
padding: 12px 35px;
margin: 0 0 20px;
background-color: #e1306c;
color: white;
border-radius: 5px;
transition: all 0.3s;
letter-spacing: 2px;
font-size: 0.85em;
font-weight: 700;
text-decoration: none;
text-transform: uppercase;
box-shadow: 0 2px 30px rgba(225, 48, 108, 0.4);
}
a:hover {
background-color: #e75d8c;
}
.content-wrapper {
width: 300px;
max-height: 530px;
border-radius: 5px;
box-shadow: 0 2px 30px rgba(0, 0, 0, 0.2);
background: #fbfcee;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
overflow-y: scroll;
overflow-x: hidden;
text-align: center;
}
.content-wrapper::-webkit-scrollbar {
display: none;
}
.content-wrapper .img {
width: 302px;
height: 350px;
position: relative;
overflow: hidden;
}
.content-wrapper .img::after {
content: "";
display: block;
position: absolute;
top: 0;
width: 100%;
height: 100%;
background: linear-gradient(to top, rgba(88, 81, 219, 0.25), transparent);
}
.content-wrapper img {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 100%;
object-fit: contain;
}
.profile--info {
text-align: left;
padding-top: 10px;
}
.profile--info span {
font-family: "Open Sans", "Adobe Blank";
z-index: 1;
left: 15px;
top: 15px;
font-size: 0.575em;
color: rgba(84, 95, 89, 0.75);
display: block;
}
.profile--info span.username {
font-weight: 700;
font-style: normal;
font-size: 1em;
color: black;
}
.profile--info span.userquote {
margin-top: -15px;
font-size: 0.7em;
color: rgba(84, 95, 89, 0.75);
}
.user {
background-color: white;
width: 100%;
margin-top: 0;
max-height: 600px;
position: relative;
padding: 0 30px;
box-sizing: border-box;
}
.user-social-wrapper {
display: flex;
justify-content: space-around;
position: relative;
padding: 5px 0;
padding-bottom: 15px;
}
.user-social-wrapper::after, .user-social-wrapper::before {
content: "";
display: block;
position: absolute;
top: 0;
width: 100%;
height: 1px;
}
.user-social-wrapper::before {
top: initial;
bottom: 0;
}
.user-social-wrapper .user-info {
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
font-weight: 200;
flex: 1 1;
}
.user-social-wrapper .user-info span:first-child {
font-size: 1.25em;
}
.user-social-wrapper .user-info span:last-child {
font-size: 0.75em;
color: rgba(84, 95, 89, 0.75);
}
.shots {
width: calc(100% + 60px);
margin-left: -30px;
position: relative;
display: flex;
flex-wrap: wrap;
}
.shots .shot {
overflow: hidden;
position: relative;
width: 100px;
height: 100px;
}
.shots .shot::after {
content: "";
display: block;
opacity: 0;
transition: all 0.255s;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
}
.shots .shot img {
transition: all 0.255s;
width: 102px;
}
#keyframes drift {
from {
transform: rotate(0deg);
}
from {
transform: rotate(360deg);
}
}
<div class="content-wrapper">
<div class="user">
<div class="shots">
<div class="shot"><img src="https://scontent-sea1-1.cdninstagram.com/vp/c2daebf39514481b7bdd696df185794a/5CB41E95/t51.2885-15/e35/44305549_353634695394272_4379074065337998962_n.jpg?_nc_ht=scontent-sea1-1.cdninstagram.com&se=7&ig_cache_key=MTkxMjA0MDQ0OTAyMTY1Njc4Mg%3D%3D.2"></div>
<div class="shot"><img src="https://scontent-sea1-1.cdninstagram.com/vp/c079f9938e0004cd465e9b3a23823638/5CB841C6/t51.2885-15/e35/41336764_2309590515939856_3014107714986624367_n.jpg?_nc_ht=scontent-sea1-1.cdninstagram.com&se=7&ig_cache_key=MTg3Nzg1Mjk1Njk0NDkwNTAwMg%3D%3D.2"></div>
<div class="shot"><img src="https://scontent-sea1-1.cdninstagram.com/vp/4c03bcf4125a52da4db64348fded2e64/5CD059B2/t51.2885-15/e35/46699770_789255231412285_7247415646102729111_n.jpg?_nc_ht=scontent-sea1-1.cdninstagram.com&se=7&ig_cache_key=MTkyMjcyMTIwOTQyODk0Mjc5NQ%3D%3D.2"></div>
<div class="shot"><img src="https://scontent-sea1-1.cdninstagram.com/vp/2ddf693641bf3e4dad7f0e4113196ed3/5C9D1D98/t51.2885-15/e35/42593422_668756993510074_548785136612309253_n.jpg?_nc_ht=scontent-sea1-1.cdninstagram.com&se=7&ig_cache_key=MTg4MjI5MDk5MzYyODEwOTk0Mw%3D%3D.2"></div>
<div class="shot"><img src="https://scontent-sea1-1.cdninstagram.com/vp/293669652704407f1519034a237110fc/5CD53EA6/t51.2885-15/e35/44442144_2039456152959656_8454847146314760657_n.jpg?_nc_ht=scontent-sea1-1.cdninstagram.com&se=7&ig_cache_key=MTkxMTEwMTUwMTEzOTEzMzk4MA%3D%3D.2"></div>
<div class="shot"><img src="https://scontent-sea1-1.cdninstagram.com/vp/0a8c6666eeaace1c7eff30c25aa672c6/5CD46203/t51.2885-15/e35/43816352_986229031581012_2433270463824730761_n.jpg?_nc_ht=scontent-sea1-1.cdninstagram.com&se=7&ig_cache_key=MTg5NTQwODg2MDE5NjA5OTA1NQ%3D%3D.2"></div>
<div class="shot"><img src="https://scontent-sea1-1.cdninstagram.com/vp/7841eff64f571f60c9ec1d169158851e/5C9BD445/t51.2885-15/e35/43621864_2280294755587222_1177965970195440793_n.jpg?_nc_ht=scontent-sea1-1.cdninstagram.com&se=7&ig_cache_key=MTg4NjY0MTkwODQ0MTE4MDcyOQ%3D%3D.2"></div>
<div class="shot"><img src="https://scontent-sea1-1.cdninstagram.com/vp/a78a72efb59d50ceeae8e6bcbaa82f92/5CCFD742/t51.2885-15/e35/42927631_265838184102659_8658034749053379565_n.jpg?_nc_ht=scontent-sea1-1.cdninstagram.com&se=7&ig_cache_key=MTkxNjkzMDk2MDM3NTMwNTUzOA%3D%3D.2"></div>
<div class="shot"><img src="https://scontent-sea1-1.cdninstagram.com/vp/77a032f68b948ae7049ea644777fc393/5CB3E901/t51.2885-15/e35/41866047_1814622118587789_2219135764187038727_n.jpg?_nc_ht=scontent-sea1-1.cdninstagram.com&se=7&ig_cache_key=MTg4NDI5OTEwNzU1ODU4OTEzMg%3D%3D.2"></div>
</div>
<div class="profile--info"><span class="username">ʏɪɴʀᴜɪ ᴅᴇɴɢ</span><span>☺#bobby_dyr</span><br><span class="userquote">In 2018, ʏɪɴʀᴜɪ ᴅᴇɴɢ received 164❤️, 7✉️ per post by average, and a total of</span></div>
<div class="user-social-wrapper">
<div class="user-info user-posts"><span>104</span><span>Shots</span></div>
<div class="user-info user-followers"><span>16,963</span><span>Likes</span></div>
<div class="user-info user-following"><span>643</span><span>Comments</span></div>
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://use.fontawesome.com/f09496b7cc.js"></script>
<script src="js/index.js"></script>
</div>
The following styles are enough to make your images fit:
.content-wrapper img {
width: 100%;
height: 100%;
object-fit: cover;
}
Don't forget to set height and width to 100%.
#import url("https://fonts.googleapis.com/css?family=Montserrat");
#import url("https://fonts.googleapis.com/css?family=Open+Sans");
body, html {
width: 100%;
height: 100%;
font-family: "Montserrat";
color: #303633;
background-color: #C8D9E7;
overflow: hidden;
font-size: 1em;
font-style: normal;
-webkit-appearance: none;
outline: none;
text-rendering: geometricPrecision;
perspective: 1000px;
}
a {
position: relative;
display: inline-block;
padding: 12px 35px;
margin: 0 0 20px;
background-color: #e1306c;
color: white;
border-radius: 5px;
transition: all 0.3s;
letter-spacing: 2px;
font-size: 0.85em;
font-weight: 700;
text-decoration: none;
text-transform: uppercase;
box-shadow: 0 2px 30px rgba(225, 48, 108, 0.4);
}
a:hover {
background-color: #e75d8c;
}
.content-wrapper {
width: 300px;
max-height: 530px;
border-radius: 5px;
box-shadow: 0 2px 30px rgba(0, 0, 0, 0.2);
background: #fbfcee;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
overflow-y: scroll;
overflow-x: hidden;
text-align: center;
}
.content-wrapper::-webkit-scrollbar {
display: none;
}
.content-wrapper .img {
width: 302px;
height: 350px;
position: relative;
overflow: hidden;
}
.content-wrapper .img::after {
content: "";
display: block;
position: absolute;
top: 0;
width: 100%;
height: 100%;
background: linear-gradient(to top, rgba(88, 81, 219, 0.25), transparent);
}
.content-wrapper img {
/*
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 100%;
object-fit: contain;
*/
width: 100%;
height: 100%;
object-fit: cover;
}
.profile--info {
text-align: left;
padding-top: 10px;
}
.profile--info span {
font-family: "Open Sans", "Adobe Blank";
z-index: 1;
left: 15px;
top: 15px;
font-size: 0.575em;
color: rgba(84, 95, 89, 0.75);
display: block;
}
.profile--info span.username {
font-weight: 700;
font-style: normal;
font-size: 1em;
color: black;
}
.profile--info span.userquote {
margin-top: -15px;
font-size: 0.7em;
color: rgba(84, 95, 89, 0.75);
}
.user {
background-color: white;
width: 100%;
margin-top: 0;
max-height: 600px;
position: relative;
padding: 0 30px;
box-sizing: border-box;
}
.user-social-wrapper {
display: flex;
justify-content: space-around;
position: relative;
padding: 5px 0;
padding-bottom: 15px;
}
.user-social-wrapper::after, .user-social-wrapper::before {
content: "";
display: block;
position: absolute;
top: 0;
width: 100%;
height: 1px;
}
.user-social-wrapper::before {
top: initial;
bottom: 0;
}
.user-social-wrapper .user-info {
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
font-weight: 200;
flex: 1 1;
}
.user-social-wrapper .user-info span:first-child {
font-size: 1.25em;
}
.user-social-wrapper .user-info span:last-child {
font-size: 0.75em;
color: rgba(84, 95, 89, 0.75);
}
.shots {
width: calc(100% + 60px);
margin-left: -30px;
position: relative;
display: flex;
flex-wrap: wrap;
}
.shots .shot {
overflow: hidden;
position: relative;
width: 100px;
height: 100px;
}
.shots .shot::after {
content: "";
display: block;
opacity: 0;
transition: all 0.255s;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
}
.shots .shot img {
transition: all 0.255s;
width: 102px;
}
#keyframes drift {
from {
transform: rotate(0deg);
}
from {
transform: rotate(360deg);
}
}
<div class="content-wrapper">
<div class="user">
<div class="shots">
<div class="shot"><img src="https://scontent-sea1-1.cdninstagram.com/vp/c2daebf39514481b7bdd696df185794a/5CB41E95/t51.2885-15/e35/44305549_353634695394272_4379074065337998962_n.jpg?_nc_ht=scontent-sea1-1.cdninstagram.com&se=7&ig_cache_key=MTkxMjA0MDQ0OTAyMTY1Njc4Mg%3D%3D.2"></div>
<div class="shot"><img src="https://scontent-sea1-1.cdninstagram.com/vp/c079f9938e0004cd465e9b3a23823638/5CB841C6/t51.2885-15/e35/41336764_2309590515939856_3014107714986624367_n.jpg?_nc_ht=scontent-sea1-1.cdninstagram.com&se=7&ig_cache_key=MTg3Nzg1Mjk1Njk0NDkwNTAwMg%3D%3D.2"></div>
<div class="shot"><img src="https://scontent-sea1-1.cdninstagram.com/vp/4c03bcf4125a52da4db64348fded2e64/5CD059B2/t51.2885-15/e35/46699770_789255231412285_7247415646102729111_n.jpg?_nc_ht=scontent-sea1-1.cdninstagram.com&se=7&ig_cache_key=MTkyMjcyMTIwOTQyODk0Mjc5NQ%3D%3D.2"></div>
<div class="shot"><img src="https://scontent-sea1-1.cdninstagram.com/vp/2ddf693641bf3e4dad7f0e4113196ed3/5C9D1D98/t51.2885-15/e35/42593422_668756993510074_548785136612309253_n.jpg?_nc_ht=scontent-sea1-1.cdninstagram.com&se=7&ig_cache_key=MTg4MjI5MDk5MzYyODEwOTk0Mw%3D%3D.2"></div>
<div class="shot"><img src="https://scontent-sea1-1.cdninstagram.com/vp/293669652704407f1519034a237110fc/5CD53EA6/t51.2885-15/e35/44442144_2039456152959656_8454847146314760657_n.jpg?_nc_ht=scontent-sea1-1.cdninstagram.com&se=7&ig_cache_key=MTkxMTEwMTUwMTEzOTEzMzk4MA%3D%3D.2"></div>
<div class="shot"><img src="https://scontent-sea1-1.cdninstagram.com/vp/0a8c6666eeaace1c7eff30c25aa672c6/5CD46203/t51.2885-15/e35/43816352_986229031581012_2433270463824730761_n.jpg?_nc_ht=scontent-sea1-1.cdninstagram.com&se=7&ig_cache_key=MTg5NTQwODg2MDE5NjA5OTA1NQ%3D%3D.2"></div>
<div class="shot"><img src="https://scontent-sea1-1.cdninstagram.com/vp/7841eff64f571f60c9ec1d169158851e/5C9BD445/t51.2885-15/e35/43621864_2280294755587222_1177965970195440793_n.jpg?_nc_ht=scontent-sea1-1.cdninstagram.com&se=7&ig_cache_key=MTg4NjY0MTkwODQ0MTE4MDcyOQ%3D%3D.2"></div>
<div class="shot"><img src="https://scontent-sea1-1.cdninstagram.com/vp/a78a72efb59d50ceeae8e6bcbaa82f92/5CCFD742/t51.2885-15/e35/42927631_265838184102659_8658034749053379565_n.jpg?_nc_ht=scontent-sea1-1.cdninstagram.com&se=7&ig_cache_key=MTkxNjkzMDk2MDM3NTMwNTUzOA%3D%3D.2"></div>
<div class="shot"><img src="https://scontent-sea1-1.cdninstagram.com/vp/77a032f68b948ae7049ea644777fc393/5CB3E901/t51.2885-15/e35/41866047_1814622118587789_2219135764187038727_n.jpg?_nc_ht=scontent-sea1-1.cdninstagram.com&se=7&ig_cache_key=MTg4NDI5OTEwNzU1ODU4OTEzMg%3D%3D.2"></div>
</div>
<div class="profile--info"><span class="username">ʏɪɴʀᴜɪ ᴅᴇɴɢ</span><span>☺#bobby_dyr</span><br><span class="userquote">In 2018, ʏɪɴʀᴜɪ ᴅᴇɴɢ received 164❤️, 7✉️ per post by average, and a total of</span></div>
<div class="user-social-wrapper">
<div class="user-info user-posts"><span>104</span><span>Shots</span></div>
<div class="user-info user-followers"><span>16,963</span><span>Likes</span></div>
<div class="user-info user-following"><span>643</span><span>Comments</span></div>
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://use.fontawesome.com/f09496b7cc.js"></script>
<script src="js/index.js"></script>
</div>
object-fit: contain;
to
object-fit: cover;
I have a link in the final div (slide4) and it is not working. I've messed around with z-index and positioning but that didn't work.
This is my first time messing around with a parallax design and I'm using a template to familiarize myself with it, but I hit a snag in this and can't figure it out.
Here's the codepen: http://codepen.io/anon/pen/bdGcI
CSS:
<style type="text/css">
html {
height: 100%;
overflow: hidden;
}
`body {
margin:0;
padding:0;
perspective: 1px;
transform-style: preserve-3d;
height: 100%;
overflow-y: scroll;
overflow-x: hidden;
font-family: Oswald;
}`body {
margin:0;
padding:0;
perspective: 1px;
transform-style: preserve-3d;
height: 100%;
overflow-y: scroll;
overflow-x: hidden;
font-family: Oswald;
}
a:link {
text-decoration: none;
color: #fff;
}
a:visited {
text-decoration: none;
color: #ccc;
}
a:hover {
text-decoration: underline;
color: #B22222;
}
a:active {
text-decoration: underline;
}
h1 {
font-size: 550%
}
h2 {
font-size: 250%
}
p {
font-size: 140%;
line-height: 150%;
color: #333;
}
p2 {
font-size: 300%;
line-height: 150%;
color: #fff;
}
.slide {
position: relative;
padding: 25vh 10%;
min-height: 100vh;
width: 100vw;
box-sizing: border-box;
box-shadow: 0 -1px 10px rgba(0, 0, 0, .7);
transform-style: inherit;
}
img {
position: absolute;
top: 50%;
left: 35%;
width: 320px;
height: 240px;
transform: translateZ(.25px) scale(.75) translateX(-94%) translateY(-100%) rotate(2deg);
padding: 1px;
border-radius: 10px;
background: rgba(240,230,220, .7);
box-shadow: 0 0 1px rgba(0, 0, 0, .7);
}
img:last-of-type {
transform: translateZ(.4px) scale(.6) translateX(-104%) translateY(-40%) rotate(-5deg);
}
.slide:before {
content: "";
position: absolute;
top: 0;
bottom: 0;
left:0;
right:0;
}
.title {
width: 50%;
padding: 2%;
border-radius: 5px;
background: rgba(240,230,220, .7);
box-shadow: 0 0 8px rgba(0, 0, 0, .7);
}
.slide:nth-child(2n) .title {
margin-left: 0;
margin-right: auto;
}
.slide:nth-child(2n+1) .title {
margin-left: auto;
margin-right: 0;
}
.slide, .slide:before {
background: 50% 50% / cover;
}
.header {
text-align: center;
font-size: 175%;
color: #fff;
text-shadow: 0 4px 4px #000;
}
.header2 {
text-align: center;
font-size: 175%;
color: #fff;
}
#title {
background-image: url("bg2");
background-attachment: fixed;
}
#slide1:before {
background-image: url("bg3");
transform: translateZ(-1px) scale(2);
z-index:-1;
}
#slide2 {
background-image: url("bg4");
background-attachment: fixed;
}
#slide3:before {
background-image: url("bgbg");
transform: translateZ(-1px) scale(2);
z-index:-1;
}
#slide4 {
background: #222;
}
</style>
</head>
HTML in question:
<div id="slide3" class="slide">
<div class="title">
<h2>Music</h2>
<p>words words words.</p>
</div>
</div>
<div id="slide4" class="slide header2">
Final Page Link.
</div>
Because :before pseudo class is causing an overlay over the content as you have written
.slide:before {
content: "";
position: absolute;
/*top:0;*/ /*remove this */
bottom: 0;
left:0;
right:0;
}
Code pen Demo
You have .slide:before with position:absolute; if you remove that it will work, so your problem is that Absolute position is Over the Link and content. If you add position:relative; to ahref or add relative to new Container inside #slide4, it will work..
1http://codepen.io/anon/pen/HGIiF/