I'm trying to get the reddish gradient to work on the background image. There's an initial fallback image, and then this appended to the next background image: , linear-gradient(0deg,rgba(0,0,0,0.68),rgba(221,51,51,0.8)); - why is this not applying the gradient?
* {
color: #000000;
margin: 0px;
padding: 0px;
font-family: 'Open Sans',verdana,helvetica,arial,sans-serif;
font-size: 100%;
box-sizing: border-box;
}
.sadLeader {
width: 1088px;
height: 450px;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
width: 100%;
padding: 10px;
text-align: center;
background-repeat: no-repeat;
background-size: cover;
background-position: top center;
background-image: url("https://media.cntraveler.com/photos/5a0efefba15d3804847cb88b/master/w_1200,c_limit/elephant-vid-tout.jpg"); /* fallback */
background-image: url("https://media.cntraveler.com/photos/5a0efefba15d3804847cb88b/master/w_1200,c_limit/elephant-vid-tout.jpg"), linear-gradient(#eb01a5, #d13531);
background-image: url("https://media.cntraveler.com/photos/5a0efefba15d3804847cb88b/master/w_1200,c_limit/elephant-vid-tout.jpg"), linear-gradient(0deg,rgba(0,0,0,0.68),rgba(221,51,51,0.8));
}
.sadLeader h3 {
font-size: 46px;
line-height: 56px;
font-weight: 400;
}
.sadLeader p {
font-size: 25px;
line-height: 28px;
margin: 25px 0;
}
.sadLeader span {
background: red;
display: flex;
}
.sadLeader span button {
color: #000;
background-color: #fff;
transition: all 0.3s ease;
font-size: 15px;
height: 55px;
padding: 0 36px;
border: none;
}
#media (min-width: 768px) {.sadLeader span button:nth-of-type(2) { margin-left: 5% }}
#media (max-width: 767px) {
.sadLeader span { flex-direction: column }
.sadLeader span button:nth-of-type(2) { margin-top: 5% }
}
<div class="sadLeader">
<h3>Some text</h3>
<p>Some more text to go here</p>
<span>
<button>Button 1</button>
<button>Another button here...</button>
</span>
</div>
* {
color: #000000;
margin: 0px;
padding: 0px;
font-family: 'Open Sans', verdana, helvetica, arial, sans-serif;
font-size: 100%;
box-sizing: border-box;
}
.sadLeader {
width: 1088px;
height: 450px;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
width: 100%;
padding: 10px;
text-align: center;
background-repeat: no-repeat;
background-size: cover;
background-position: top center;
background-image: url("https://media.cntraveler.com/photos/5a0efefba15d3804847cb88b/master/w_1200,c_limit/elephant-vid-tout.jpg");
/* fallback */
background-image: linear-gradient(#eb01a5, #d13531), url("https://media.cntraveler.com/photos/5a0efefba15d3804847cb88b/master/w_1200,c_limit/elephant-vid-tout.jpg");
background-image: linear-gradient(0deg, rgba(0, 0, 0, 0.68), rgba(221, 51, 51, 0.8)), url("https://media.cntraveler.com/photos/5a0efefba15d3804847cb88b/master/w_1200,c_limit/elephant-vid-tout.jpg");
}
.sadLeader h3 {
font-size: 46px;
line-height: 56px;
font-weight: 400;
}
.sadLeader p {
font-size: 25px;
line-height: 28px;
margin: 25px 0;
}
.sadLeader span {
background: red;
display: flex;
}
.sadLeader span button {
color: #000;
background-color: #fff;
transition: all 0.3s ease;
font-size: 15px;
height: 55px;
padding: 0 36px;
border: none;
}
#media (min-width: 768px) {
.sadLeader span button:nth-of-type(2) {
margin-left: 5%
}
}
#media (max-width: 767px) {
.sadLeader span {
flex-direction: column
}
.sadLeader span button:nth-of-type(2) {
margin-top: 5%
}
}
<div class="sadLeader">
<h3>Some text</h3>
<p>Some more text to go here</p>
<span>
<button>Button 1</button>
<button>Another button here...</button>
</span>
</div>
Is this what you are after?
Your background-image covers the whole container (background-size: cover;), so the gradient won't become visible. It would be visible around the image if the image were smaller, not covering the container. To have the image only as a fallback, notate it as below.
* {
color: #000000;
margin: 0px;
padding: 0px;
font-family: 'Open Sans',verdana,helvetica,arial,sans-serif;
font-size: 100%;
box-sizing: border-box;
}
.sadLeader {
width: 1088px;
height: 450px;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
width: 100%;
padding: 10px;
text-align: center;
background-repeat: no-repeat;
background-size: cover;
background-position: top center;
background-image: url("https://media.cntraveler.com/photos/5a0efefba15d3804847cb88b/master/w_1200,c_limit/elephant-vid-tout.jpg"); /* fallback */
background-image: url("https://media.cntraveler.com/photos/5a0efefba15d3804847cb88b/master/w_1200,c_limit/elephant-vid-tout.jpg"), linear-gradient(#eb01a5, #d13531);
background-image: linear-gradient(0deg,rgba(0,0,0,0.68),rgba(221,51,51,0.8));
}
.sadLeader h3 {
font-size: 46px;
line-height: 56px;
font-weight: 400;
}
.sadLeader p {
font-size: 25px;
line-height: 28px;
margin: 25px 0;
}
.sadLeader span {
background: red;
display: flex;
}
.sadLeader span button {
color: #000;
background-color: #fff;
transition: all 0.3s ease;
font-size: 15px;
height: 55px;
padding: 0 36px;
border: none;
}
#media (min-width: 768px) {.sadLeader span button:nth-of-type(2) { margin-left: 5% }}
#media (max-width: 767px) {
.sadLeader span { flex-direction: column }
.sadLeader span button:nth-of-type(2) { margin-top: 5% }
}
<div class="sadLeader">
<h3>Some text</h3>
<p>Some more text to go here</p>
<span>
<button>Button 1</button>
<button>Another button here...</button>
</span>
</div>
Related
I created a basic example to illustrate the problem: https://codepen.io/itsechi/pen/wvmQEJb.
HTML:
<body>
<header>
<h1>RANDOM TEXT</h1>
<h1>MORE RANDOM TEXT</h1>
<header>
<main class="contact-main">
<section class="contact-section">
<h2>CONTACT US</h2>
<p>Random text here Random text here Random text here</p>
<p>Random text here Random text here Random text here</p>
</section>
<img src="https://i.imgur.com/g6xj3zE.jpg">
</main>
</body>
CSS:
html {
box-sizing: border-box;
font-size: 100%;
}
*,
*::before,
*::after {
box-sizing: inherit;
margin: 0;
padding: 0;
}
body {
min-height: 100vh;
font-family: "League Spartan", sans-serif;
font-weight: 700;
color: #fff;
text-align: center;
background-color: #1B191A;
position: relative;
display: flex;
justify-content: center;
}
body::before {
content: "";
position: absolute;
width: 100%;
height: 100%;
background: url("https://i.imgur.com/TJA3v8q.jpg") no-repeat center/cover;
z-index: -1;
opacity: 0.4;
}
.contact-main {
display: flex;
align-items: center;
justify-content: center;
position: relative;
}
.contact-section {
-moz-text-align-last: left;
text-align-last: left;
margin: 3rem;
font-weight: 500;
font-size: 1.3rem;
}
#media (max-width: 69.375em) {
.contact-section {
margin: 1rem;
margin-top: 2rem;
}
}
#media (max-width: 34.375em) {
.contact-section {
font-size: 0.9rem;
}
}
#media (max-width: 21.875em) {
.contact-section {
font-size: 0.6rem;
margin: 0.4rem;
}
}
.contact-section h2 {
font-weight: 500;
letter-spacing: 0.15em;
margin-bottom: 1.5rem;
}
#media (max-width: 34.375em) {
.contact-section h2 {
font-size: 1.2rem;
}
}
.contact-section button {
font-family: inherit;
padding: 0.5rem 1rem;
margin-top: 1.5rem;
letter-spacing: 0.15em;
color: #CCAB5B;
background: none;
border: 2px solid #CCAB5B;
font-size: 1rem;
cursor: pointer;
}
.contact-section button:hover {
background-color: #CCAB5B;
color: #000;
}
#media (max-width: 34.375em) {
.contact-section button {
font-size: 0.7rem;
}
}
#media (max-width: 21.875em) {
.contact-section button {
font-size: 0.5rem;
padding: 0.3rem 0.8rem;
}
}
img {
border-radius: 50%;
margin-top: 3rem;
border: 3px solid #CCAB5B;
width: 30rem;
}
#media (max-width: 69.375em) {
img {
position: absolute;
top: 80%;
width: 20rem;
}
}
#media (max-width: 34.375em) {
img {
width: 12rem;
}
}
When I resize the page to see how it looks on smaller screens the background image only fills up the height of the viewport of body and the rest of the container is just background color. The issue is best seen if you try to check how the site looks on Nest Hub in devtools. How can I stop this from happening and make the background image either repeat or better, just fill the entire space when the page becomes scrollable? Thanks.
There are plenty of properties you can implement and combine:
background-position
background-attachment
background-repeat
background-size
if you want to repeat an image you should look into background-repeat. Otherwise you should combine those properties:
body {
background: url('https://via.placeholder.com/1920x1080.jpg');
background-attachment: fixed;
background-position: center;
background-size: cover;
background-repeat: no-repeat;
}
/* for demo purpose only */
body {
min-height: 500vh;
}
I think I found out what was causing the problem - it was the absolute positioning of the img. I simply changed the display of the main element to be a grid on smaller devices and now the background is working as it should!
#media (max-width: 69.375em) {
.contact-main {
display: grid;
grid-template-columns: repeat(2, 1fr);
justify-items: center;
}
}
.contact-section {
-moz-text-align-last: left;
text-align-last: left;
margin: 3rem;
font-weight: 500;
font-size: 1.3rem;
grid-row: 1/2;
}
#media (max-width: 69.375em) {
img {
width: 20rem;
grid-column: span 2;
}
}
While developing my website I have came across a problem with my footer and form. My footer seems to be appearing through the form on devices but not on the computer and I'm sure this could be issues with widths of devices? So I kept trying to fix it and still haven't been able to fix it. I'm still learning as I go along and I would be grateful if someone could help me get rolling with my website again. code snippets and images below, kindest regards, Caelan.
body {
background-color: black ;
}
/* Announcment bar */
.alert {
padding: 20px;
background-color: #2a7a85;
color: white;
}
.closebtn {
margin-left: 15px;
color: white;
font-weight: bold;
float: right;
font-size: 22px;
line-height: 20px;
cursor: pointer;
transition: 0.3s;
}
.closebtn:hover {
color: black;
}
body {
margin: 0;
}
/* Navigation bar */
ul.topnav {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: rgb(248, 248, 248);
}
ul.topnav li {
float: left;
}
ul.topnav li a {
display: block;
color: black;
text-align: center;
font-weight: bold;
padding: 25px 32px;
text-decoration: none;
}
ul.topnav li a:hover:not(.active) {
background-color: rgb(55, 81, 165);
}
ul.topnav li a.active {
background-color: #0cc0d8;
}
ul.topnav li.right {
float: right;
}
#media screen and (max-width: 600px) {
ul.topnav li.right,
ul.topnav li {
float: none;
}
}
/* On smaller screens, decrease text size */
#media only screen and (max-width: 300px) {
.text {
font-size: 11px;
}
}
/* Homepage button */
.glow-on-hover {
width: 220px;
height: 35px;
border: none;
outline: none;
color: rgb(0, 0, 0);
font-weight: bold;
font-size: 20px;
background: #111;
cursor: pointer;
position: relative;
z-index: 0;
border-radius: 10px;
}
.glow-on-hover:before {
content: '';
background: linear-gradient(45deg, #ff0000, #ff7300, #fffb00, #48ff00, #00ffd5, #002bff, #7a00ff, #ff00c8, #ff0000);
position: absolute;
top: -2px;
left:-2px;
background-size: 400%;
z-index: -1;
filter: blur(5px);
width: calc(100% + 4px);
height: calc(100% + 4px);
animation: glowing 20s linear infinite;
opacity: 0;
transition: opacity .3s ease-in-out;
border-radius: 10px;
}
.glow-on-hover:active {
color: #000
}
.glow-on-hover:active:after {
background: transparent;
}
.glow-on-hover:hover:before {
opacity: 1;
}
.glow-on-hover:after {
z-index: -1;
content: '';
position: absolute;
width: 100%;
height: 100%;
background: rgb(11, 78, 223);
left: 0;
top: 0;
border-radius: 10px;
}
#keyframes glowing {
0% { background-position: 0 0; }
50% { background-position: 400% 0; }
100% { background-position: 0 0; }
}
/* kipplo heading on homepage */
h1 {
font-size: 10vw;
margin: 0;
padding: 0;
font-family: 'Courier New', Courier, monospace;
color: blue;
word-wrap: break-word;
text-align: center;
}
/* for the heading and the button alignment*/
.container {
display: flex;
flex-direction: column;
height: 100vh;
}
.btn-centering {
flex-grow: 1;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
/* product cards*/
h3{
text-align: center;
font-size: 30px;
margin: 0;
padding-top: 10px;
}
a{
text-decoration: none;
}
.gallery{
display: flex;
flex-wrap: wrap;
width: 100%;
justify-content: center;
align-items: center;
margin: 50px 0;
}
.content{
width: 24%;
margin: 15px;
box-sizing: border-box;
float: left;
text-align: center;
border-radius:10px;
border-top-right-radius: 10px;
border-bottom-right-radius: 10px;
padding-top: 10px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
transition: .4s;
background-color: whitesmoke;
}
.content:hover{
box-shadow: 0 0 11px rgb(0, 217, 255);
transform: translate(0px, -8px);
transition: .6s;
}
.productcard-image{
width: 200px;
height: 200px;
text-align: center;
margin: 0 auto;
display: block;
}
p{
text-align: center;
color: #b2bec3;
padding: 0 8px;
}
h6{
font-size: 26px;
text-align: center;
color: #222f3e;
margin: 0;
}
.product-card{
list-style-type: none;
display: flex;
justify-content: center;
align-items: center;
padding: 0px;
}
.productcard-list{
padding: 5px;
}
.fa{
color: #ff9f43;
font-size: 26px;
transition: .4s;
}
.fa:hover{
transform: scale(1.3);
transition: .6s;
}
.productcardbutton{
text-align: center;
font-size: 24px;
color: #fff;
width: 100%;
padding: 15px;
border:0px;
outline: none;
cursor: pointer;
margin-top: 5px;
border-bottom-right-radius: 10px;
border-bottom-left-radius: 10px;
}
.buy-1{
background-color: #2183a2;
}
.buy-2{
background-color: #3b3e6e;
}
.buy-3{
background-color: #0b0b0b;
}
#media(max-width: 1000px){
.content{
width: 46%;
}
}
#media(max-width: 750px){
.content{
width: 100%;
}
}
/* Footer */
.footer__container {
background-color: #141414;
padding: 5rem 0;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
#footer__logo {
color: #fff;
display: flex;
align-items: center;
cursor: pointer;
text-decoration: none;
font-size: 2rem;
}
.footer__links {
width: 100%;
max-width: 1000px;
display: flex;
justify-content: center;
}
.footer__link--wrapper {
display: flex;
}
.footer__link--items {
display: flex;
flex-direction: column;
align-items: flex-start;
margin: 16px;
text-align: left;
width: 160px;
box-sizing: border-box;
}
.footer__link--items h2 {
margin-bottom: 16px;
}
.footer__link--items > h2 {
color: #fff;
}
.footer__link--items a {
color: #fff;
text-decoration: none;
margin-bottom: 0.5rem;
}
.footer__link--items a:hover {
color: #e9e9e9;
transition: 0.3s ease-out;
}
/* Social Icons */
.social__icon--link {
color: #fff;
font-size: 24px;
}
.social__media {
max-width: 1000px;
width: 100%;
}
.social__media--wrap {
display: flex;
justify-content: space-between;
align-items: center;
width: 90%;
max-width: 1000px;
margin: 40px auto 0 auto;
}
.website__rights {
color: #fff;
}
#media screen and (max-width: 820px) {
.footer__links {
padding-top: 2rem;
}
#footer__logo {
margin-bottom: 2rem;
}
.website__rights {
padding: 2rem;
}
.footer__link--wrapper {
flex-direction: column;
}
.social__media--wrap {
flex-direction: column;
}
}
#media screen and (max-width: 480px) {
.footer__link--items {
margin: 0;
padding: 10px;
width: 100%;
}
}
/* Text above the form*/
/* Feedback form*/
.form1 {
display: flex;
flex-direction: column;
align-items: center;
width: 500px;
margin: 15vh auto;
margin-bottom: -60vh;
border-radius: 15px;
border: none;
box-shadow: 0 0 15px rgb(24, 143, 190);
}
form {
display: flex;
flex-direction: column;
align-items: center;
width: 90%;
}
input {
width: 100%;
margin: 5px 0;
height: 35px;
font-size: 17px;
text-align: center;
outline: none;
border-radius: 15px;
border: none;
background: rgb(235, 228, 228);
}
textarea {
width: 100%;
margin: 5px 0;
font-size: 17px;
text-align: center;
outline: none;
border-radius: 15px;
border: none;
background: rgb(235, 228, 228);
}
input[type=submit]{
margin: 10px auto;
width: 120px;
background: rgb(24, 143, 190);
color: white;
cursor: pointer;
}
input[type=submit]:hover{
background: rgb(19, 41, 238);
}
#media screen and (max-width:600px) {
.form1{
width: 90%;
}
}
h2 {
color: #00ffd5;
font-size: 30px;
}
p4 {
color: #00ffd5;
font-size: 20px;
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="icon" href="img/icon.png" />
<link rel="stylesheet" href="styles.css" />
<title>Contact Us</title>
</head>
<body>
<!-- Alert bar -->
<div class="container">
<div class="alert">
<span
class="closebtn"
onclick="this.parentElement.style.display='none';"
>×</span>
<center>
<strong>DEALS NOW ON!</strong> Upto 30% discounts this
christmas
</center>
</div>
<!-- Navigation bar -->
<ul class="topnav">
<li><img src="img/logo.png" /></li>
<li>Home</li>
<li>Products</li>
<li><a class="active" href="contactus.html">Contact Us</a></li>
<li class="right">About Us</li>
</ul>
<!-- Form -->
<div class="form1">
<h2>Contact Us!</h2>
<p4>Typical Replies Within 24hrs!</p4>
<br>
<form action="">
<input type="email" name="email" id="email" placeholder="Enter your email">
<input type="text" name="name" id="name" placeholder=" Enter your name">
<textarea name="message" id="message" cols="30" rows="10" placeholder="Enter your message here"></textarea>
<input type="submit" value="Send">
</form>
</div>
</div>
<!-- Footer -->
<div class="footer__container">
<div class="footer__links">
<div class="footer__link--wrapper">
<div class="footer__link--items">
About Us
</div>
<div class="footer__link--items">
Contact Us
</div>
</div>
<div class="footer__link--wrapper">
<div class="footer__link--items">
Youtube
</div>
<div class="footer__link--items">
TikTok
</div>
</div>
</div>
<section class="social__media">
<div class="social__media--wrap">
<div class="footer__logo">
<a href="index.html">
<img src="img/logo2.png" id="footer__logo" ></a>
</div>
<p class="website__rights">© KIPPLO.CO.UK PROTOTYPE 2022. All rights reserved</p>
<div class="social__icons">
</div>
</div>
</section>
</div>
</body>
</html>
I've adjusted the css to remove the height and margin on the containers:
body {
background-color: black;
}
/* Announcment bar */
.alert {
padding: 20px;
background-color: #2a7a85;
color: white;
}
.closebtn {
margin-left: 15px;
color: white;
font-weight: bold;
float: right;
font-size: 22px;
line-height: 20px;
cursor: pointer;
transition: 0.3s;
}
.closebtn:hover {
color: black;
}
body {
margin: 0;
}
/* Navigation bar */
ul.topnav {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: rgb(248, 248, 248);
}
ul.topnav li {
float: left;
}
ul.topnav li a {
display: block;
color: black;
text-align: center;
font-weight: bold;
padding: 25px 32px;
text-decoration: none;
}
ul.topnav li a:hover:not(.active) {
background-color: rgb(55, 81, 165);
}
ul.topnav li a.active {
background-color: #0cc0d8;
}
ul.topnav li.right {
float: right;
}
#media screen and (max-width: 600px) {
ul.topnav li.right,
ul.topnav li {
float: none;
}
}
/* On smaller screens, decrease text size */
#media only screen and (max-width: 300px) {
.text {
font-size: 11px;
}
}
/* Homepage button */
.glow-on-hover {
width: 220px;
height: 35px;
border: none;
outline: none;
color: rgb(0, 0, 0);
font-weight: bold;
font-size: 20px;
background: #111;
cursor: pointer;
position: relative;
z-index: 0;
border-radius: 10px;
}
.glow-on-hover:before {
content: "";
background: linear-gradient(
45deg,
#ff0000,
#ff7300,
#fffb00,
#48ff00,
#00ffd5,
#002bff,
#7a00ff,
#ff00c8,
#ff0000
);
position: absolute;
top: -2px;
left: -2px;
background-size: 400%;
z-index: -1;
filter: blur(5px);
width: calc(100% + 4px);
height: calc(100% + 4px);
animation: glowing 20s linear infinite;
opacity: 0;
transition: opacity 0.3s ease-in-out;
border-radius: 10px;
}
.glow-on-hover:active {
color: #000;
}
.glow-on-hover:active:after {
background: transparent;
}
.glow-on-hover:hover:before {
opacity: 1;
}
.glow-on-hover:after {
z-index: -1;
content: "";
position: absolute;
width: 100%;
height: 100%;
background: rgb(11, 78, 223);
left: 0;
top: 0;
border-radius: 10px;
}
#keyframes glowing {
0% {
background-position: 0 0;
}
50% {
background-position: 400% 0;
}
100% {
background-position: 0 0;
}
}
/* kipplo heading on homepage */
h1 {
font-size: 10vw;
margin: 0;
padding: 0;
font-family: "Courier New", Courier, monospace;
color: blue;
word-wrap: break-word;
text-align: center;
}
/* for the heading and the button alignment*/
.container {
display: flex;
flex-direction: column;
}
.btn-centering {
flex-grow: 1;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
/* product cards*/
h3 {
text-align: center;
font-size: 30px;
margin: 0;
padding-top: 10px;
}
a {
text-decoration: none;
}
.gallery {
display: flex;
flex-wrap: wrap;
width: 100%;
justify-content: center;
align-items: center;
margin: 50px 0;
}
.content {
width: 24%;
margin: 15px;
box-sizing: border-box;
float: left;
text-align: center;
border-radius: 10px;
border-top-right-radius: 10px;
border-bottom-right-radius: 10px;
padding-top: 10px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
transition: 0.4s;
background-color: whitesmoke;
}
.content:hover {
box-shadow: 0 0 11px rgb(0, 217, 255);
transform: translate(0px, -8px);
transition: 0.6s;
}
.productcard-image {
width: 200px;
height: 200px;
text-align: center;
margin: 0 auto;
display: block;
}
p {
text-align: center;
color: #b2bec3;
padding: 0 8px;
}
h6 {
font-size: 26px;
text-align: center;
color: #222f3e;
margin: 0;
}
.product-card {
list-style-type: none;
display: flex;
justify-content: center;
align-items: center;
padding: 0px;
}
.productcard-list {
padding: 5px;
}
.fa {
color: #ff9f43;
font-size: 26px;
transition: 0.4s;
}
.fa:hover {
transform: scale(1.3);
transition: 0.6s;
}
.productcardbutton {
text-align: center;
font-size: 24px;
color: #fff;
width: 100%;
padding: 15px;
border: 0px;
outline: none;
cursor: pointer;
margin-top: 5px;
border-bottom-right-radius: 10px;
border-bottom-left-radius: 10px;
}
.buy-1 {
background-color: #2183a2;
}
.buy-2 {
background-color: #3b3e6e;
}
.buy-3 {
background-color: #0b0b0b;
}
#media (max-width: 1000px) {
.content {
width: 46%;
}
}
#media (max-width: 750px) {
.content {
width: 100%;
}
}
/* Footer */
.footer__container {
background-color: #141414;
padding: 5rem 0;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
#footer__logo {
color: #fff;
display: flex;
align-items: center;
cursor: pointer;
text-decoration: none;
font-size: 2rem;
}
.footer__links {
width: 100%;
max-width: 1000px;
display: flex;
justify-content: center;
}
.footer__link--wrapper {
display: flex;
}
.footer__link--items {
display: flex;
flex-direction: column;
align-items: flex-start;
margin: 16px;
text-align: left;
width: 160px;
box-sizing: border-box;
}
.footer__link--items h2 {
margin-bottom: 16px;
}
.footer__link--items > h2 {
color: #fff;
}
.footer__link--items a {
color: #fff;
text-decoration: none;
margin-bottom: 0.5rem;
}
.footer__link--items a:hover {
color: #e9e9e9;
transition: 0.3s ease-out;
}
/* Social Icons */
.social__icon--link {
color: #fff;
font-size: 24px;
}
.social__media {
max-width: 1000px;
width: 100%;
}
.social__media--wrap {
display: flex;
justify-content: space-between;
align-items: center;
width: 90%;
max-width: 1000px;
margin: 40px auto 0 auto;
}
.website__rights {
color: #fff;
}
#media screen and (max-width: 820px) {
.footer__links {
padding-top: 2rem;
}
#footer__logo {
margin-bottom: 2rem;
}
.website__rights {
padding: 2rem;
}
.footer__link--wrapper {
flex-direction: column;
}
.social__media--wrap {
flex-direction: column;
}
}
#media screen and (max-width: 480px) {
.footer__link--items {
margin: 0;
padding: 10px;
width: 100%;
}
}
/* Text above the form*/
/* Feedback form*/
.form1 {
display: flex;
flex-direction: column;
align-items: center;
width: 500px;
margin: 15vh auto;
border-radius: 15px;
border: none;
box-shadow: 0 0 15px rgb(24, 143, 190);
}
form {
display: flex;
flex-direction: column;
align-items: center;
width: 90%;
}
input {
width: 100%;
margin: 5px 0;
height: 35px;
font-size: 17px;
text-align: center;
outline: none;
border-radius: 15px;
border: none;
background: rgb(235, 228, 228);
}
textarea {
width: 100%;
margin: 5px 0;
font-size: 17px;
text-align: center;
outline: none;
border-radius: 15px;
border: none;
background: rgb(235, 228, 228);
}
input[type="submit"] {
margin: 10px auto;
width: 120px;
background: rgb(24, 143, 190);
color: white;
cursor: pointer;
}
input[type="submit"]:hover {
background: rgb(19, 41, 238);
}
#media screen and (max-width: 600px) {
.form1 {
width: 90%;
}
}
h2 {
color: #00ffd5;
font-size: 30px;
}
p4 {
color: #00ffd5;
font-size: 20px;
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="icon" href="img/icon.png" />
<link rel="stylesheet" href="styles.css" />
<title>Contact Us</title>
</head>
<body>
<!-- Alert bar -->
<div class="container">
<div class="alert">
<span
class="closebtn"
onclick="this.parentElement.style.display='none';"
>×</span
>
<center>
<strong>DEALS NOW ON!</strong> Upto 30% discounts this christmas
</center>
</div>
<!-- Navigation bar -->
<ul class="topnav">
<li><img src="img/logo.png" /></li>
<li>Home</li>
<li>Products</li>
<li><a class="active" href="contactus.html">Contact Us</a></li>
<li class="right">About Us</li>
</ul>
<!-- Form -->
<div class="form1">
<h2>Contact Us!</h2>
<p4>Typical Replies Within 24hrs!</p4>
<br />
<form action="">
<input
type="email"
name="email"
id="email"
placeholder="Enter your email"
/>
<input
type="text"
name="name"
id="name"
placeholder=" Enter your name"
/>
<textarea
name="message"
id="message"
cols="30"
rows="10"
placeholder="Enter your message here"
></textarea>
<input type="submit" value="Send" />
</form>
</div>
</div>
<!-- Footer -->
<div class="footer__container">
<div class="footer__links">
<div class="footer__link--wrapper">
<div class="footer__link--items">
About Us
</div>
<div class="footer__link--items">
Contact Us
</div>
</div>
<div class="footer__link--wrapper">
<div class="footer__link--items">
Youtube
</div>
<div class="footer__link--items">
TikTok
</div>
</div>
</div>
<section class="social__media">
<div class="social__media--wrap">
<div class="footer__logo">
<a href="index.html">
<img src="img/logo2.png" id="footer__logo"
/></a>
</div>
<p class="website__rights">
© KIPPLO.CO.UK PROTOTYPE 2022. All rights reserved
</p>
<div class="social__icons"></div>
</div>
</section>
</div>
</body>
</html>
I'm using margins for my form but when I am testing the responsive layout the distance between the navigation bar increases if the screen width is a greater size. Therefore, I have also tried auto height but it still has a big gap between the navigation bar and the form.
I have also tried #media screen.
I had help yesterday with a similar problem to this, but now I'm encountering another one as its not with the footer but with the form itself.
I would kindly like to ask for help, and if you find a solution explain the changes so I can also learn from it! Kindest regards, Caelan : ).
body {
background-color: black;
}
/* Announcment bar */
.alert {
padding: 20px;
background-color: #2a7a85;
color: white;
}
.closebtn {
margin-left: 15px;
color: white;
font-weight: bold;
float: right;
font-size: 22px;
line-height: 20px;
cursor: pointer;
transition: 0.3s;
}
.closebtn:hover {
color: black;
}
body {
margin: 0;
}
/* Navigation bar */
ul.topnav {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: rgb(248, 248, 248);
}
ul.topnav li {
float: left;
}
ul.topnav li a {
display: block;
color: black;
text-align: center;
font-weight: bold;
padding: 25px 32px;
text-decoration: none;
}
ul.topnav li a:hover:not(.active) {
background-color: rgb(55, 81, 165);
}
ul.topnav li a.active {
background-color: #0cc0d8;
}
ul.topnav li.right {
float: right;
}
#media screen and (max-width: 600px) {
ul.topnav li.right,
ul.topnav li {
float: none;
}
}
/* On smaller screens, decrease text size */
#media only screen and (max-width: 300px) {
.text {
font-size: 11px;
}
}
/* Homepage button */
.glow-on-hover {
width: 220px;
height: 35px;
border: none;
outline: none;
color: rgb(0, 0, 0);
font-weight: bold;
font-size: 20px;
background: #111;
cursor: pointer;
position: relative;
z-index: 0;
border-radius: 10px;
}
.glow-on-hover:before {
content: "";
background: linear-gradient(
45deg,
#ff0000,
#ff7300,
#fffb00,
#48ff00,
#00ffd5,
#002bff,
#7a00ff,
#ff00c8,
#ff0000
);
position: absolute;
top: -2px;
left: -2px;
background-size: 400%;
z-index: -1;
filter: blur(5px);
width: calc(100% + 4px);
height: calc(100% + 4px);
animation: glowing 20s linear infinite;
opacity: 0;
transition: opacity 0.3s ease-in-out;
border-radius: 10px;
}
.glow-on-hover:active {
color: #000;
}
.glow-on-hover:active:after {
background: transparent;
}
.glow-on-hover:hover:before {
opacity: 1;
}
.glow-on-hover:after {
z-index: -1;
content: "";
position: absolute;
width: 100%;
height: 100%;
background: rgb(11, 78, 223);
left: 0;
top: 0;
border-radius: 10px;
}
#keyframes glowing {
0% {
background-position: 0 0;
}
50% {
background-position: 400% 0;
}
100% {
background-position: 0 0;
}
}
/* kipplo heading on homepage */
h1 {
font-size: 10vw;
margin: 0;
padding: 0;
font-family: "Courier New", Courier, monospace;
color: blue;
word-wrap: break-word;
text-align: center;
}
/* for the heading and the button alignment*/
.container {
display: flex;
flex-direction: column;
height: 100vh;
}
.btn-centering {
flex-grow: 1;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
/* product cards*/
h3 {
text-align: center;
font-size: 30px;
margin: 0;
padding-top: 10px;
}
a {
text-decoration: none;
}
.gallery {
display: flex;
flex-wrap: wrap;
width: 100%;
justify-content: center;
align-items: center;
margin: 50px 0;
}
.content {
width: 24%;
margin: 15px;
box-sizing: border-box;
float: left;
text-align: center;
border-radius: 10px;
border-top-right-radius: 10px;
border-bottom-right-radius: 10px;
padding-top: 10px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
transition: 0.4s;
background-color: whitesmoke;
}
.content:hover {
box-shadow: 0 0 11px rgb(0, 217, 255);
transform: translate(0px, -8px);
transition: 0.6s;
}
.productcard-image {
width: 200px;
height: 200px;
text-align: center;
margin: 0 auto;
display: block;
}
p {
text-align: center;
color: #b2bec3;
padding: 0 8px;
}
h6 {
font-size: 26px;
text-align: center;
color: #222f3e;
margin: 0;
}
.product-card {
list-style-type: none;
display: flex;
justify-content: center;
align-items: center;
padding: 0px;
}
.productcard-list {
padding: 5px;
}
.fa {
color: #ff9f43;
font-size: 26px;
transition: 0.4s;
}
.fa:hover {
transform: scale(1.3);
transition: 0.6s;
}
.productcardbutton {
text-align: center;
font-size: 24px;
color: #fff;
width: 100%;
padding: 15px;
border: 0px;
outline: none;
cursor: pointer;
margin-top: 5px;
border-bottom-right-radius: 10px;
border-bottom-left-radius: 10px;
}
.buy-1 {
background-color: #2183a2;
}
.buy-2 {
background-color: #3b3e6e;
}
.buy-3 {
background-color: #0b0b0b;
}
#media (max-width: 1000px) {
.content {
width: 46%;
}
}
#media (max-width: 750px) {
.content {
width: 100%;
}
}
/* Footer */
.footer__container {
background-color: #141414;
padding: 5rem 0;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
#footer__logo {
color: #fff;
display: flex;
align-items: center;
cursor: pointer;
text-decoration: none;
font-size: 2rem;
}
.footer__links {
width: 100%;
max-width: 1000px;
display: flex;
justify-content: center;
}
.footer__link--wrapper {
display: flex;
}
.footer__link--items {
display: flex;
flex-direction: column;
align-items: flex-start;
margin: 16px;
text-align: left;
width: 160px;
box-sizing: border-box;
}
.footer__link--items h2 {
margin-bottom: 16px;
}
.footer__link--items > h2 {
color: #fff;
}
.footer__link--items a {
color: #fff;
text-decoration: none;
margin-bottom: 0.5rem;
}
.footer__link--items a:hover {
color: #e9e9e9;
transition: 0.3s ease-out;
}
/* Social Icons */
.social__icon--link {
color: #fff;
font-size: 24px;
}
.social__media {
max-width: 1000px;
width: 100%;
}
.social__media--wrap {
display: flex;
justify-content: space-between;
align-items: center;
width: 90%;
max-width: 1000px;
margin: 40px auto 0 auto;
}
.website__rights {
color: #fff;
}
#media screen and (max-width: 820px) {
.footer__links {
padding-top: 2rem;
}
#footer__logo {
margin-bottom: 2rem;
}
.website__rights {
padding: 2rem;
}
.footer__link--wrapper {
flex-direction: column;
}
.social__media--wrap {
flex-direction: column;
}
}
#media screen and (max-width: 480px) {
.footer__link--items {
margin: 0;
padding: 10px;
width: 100%;
}
}
/* Text above the form*/
/* Feedback form*/
.form1 {
display: flex;
flex-direction: column;
align-items: center;
width: 500px;
margin: 15vh auto;
margin-top: -200px;
height: auto;
border-radius: 15px;
border: none;
box-shadow: 0 0 15px rgb(24, 143, 190);
}
form {
display: flex;
flex-direction: column;
align-items: center;
width: 90%;
}
input {
width: 100%;
margin: 5px 0;
height: 35px;
font-size: 17px;
text-align: center;
outline: none;
border-radius: 15px;
border: none;
background: rgb(235, 228, 228);
}
textarea {
width: 100%;
margin: 5px 0;
font-size: 17px;
text-align: center;
outline: none;
border-radius: 15px;
border: none;
background: rgb(235, 228, 228);
}
input[type="submit"] {
margin: 10px auto;
width: 120px;
background: rgb(24, 143, 190);
color: white;
cursor: pointer;
}
input[type="submit"]:hover {
background: rgb(19, 41, 238);
}
#media screen and (max-width: 600px) {
.form1 {
width: 90%;
margin-top:-250px;
height: auto;
}
}
h2 {
color: #00ffd5;
font-size: 30px;
}
p4 {
color: #00ffd5;
font-size: 20px;
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="icon" href="img/icon.png" />
<link rel="stylesheet" href="styles.css" />
<title>Contact Us</title>
</head>
<body>
<!-- Alert bar -->
<div class="container">
<div class="alert">
<span
class="closebtn"
onclick="this.parentElement.style.display='none';"
>×</span
>
<center>
<strong>DEALS NOW ON!</strong> Upto 30% discounts this christmas
</center>
</div>
<!-- Navigation bar -->
<ul class="topnav">
<li><img src="img/logo.png" /></li>
<li>Home</li>
<li>Products</li>
<li><a class="active" href="contactus.html">Contact Us</a></li>
<li class="right">About Us</li>
</ul>
</div>
<!-- Form -->
<div class="form1">
<h2>Contact Us!</h2>
<p4>Typical Replies Within 24hrs!</p4>
<br />
<form action="">
<input
type="email"
name="email"
id="email"
placeholder="Enter your email"
/>
<input
type="text"
name="name"
id="name"
placeholder=" Enter your name"
/>
<textarea
name="message"
id="message"
cols="30"
rows="10"
placeholder="Enter your message here"
></textarea>
<input type="submit" value="Send" />
</form>
</div>
</div>
<!-- Footer -->
<div class="footer__container">
<div class="footer__links">
<div class="footer__link--wrapper">
<div class="footer__link--items">
About Us
</div>
<div class="footer__link--items">
Contact Us
</div>
</div>
<div class="footer__link--wrapper">
<div class="footer__link--items">
Youtube
</div>
<div class="footer__link--items">
TikTok
</div>
</div>
</div>
<section class="social__media">
<div class="social__media--wrap">
<div class="footer__logo">
<a href="index.html">
<img src="img/logo2.png" id="footer__logo"
/></a>
</div>
<p class="website__rights">
© KIPPLO.CO.UK PROTOTYPE 2022. All rights reserved
</p>
<div class="social__icons"></div>
</div>
</[![section][1]][1]>
</div>
</body>
</html>
I analyzed your code. You have just to remove the height: 100vh from your .container.
The next step is to remove the margin-top: -250px from your .form1. then it should look good.
Bonus Tip: the unit vh stands for viewport-height (browser height). so 100vh is 100% of the viewport height.
There is a blue space next to my support button when I inspect and click on the navbar. Why is it there and not taking up the full space. It is supposed to be pushed all the way to the right. I have only used flexbox.
What I wanted to do was have it take that space and get rid of it.
:root {
--cta-color: #a82534;
--main-grey-color: #e2dde1;
--brown-color: #a08f81;
}
html,
body {
height: 100%;
}
img {
width: 100%;
}
main {
min-height: 100vh;
background-color: var(--main-grey-color);
background: -webkit-linear-gradient(
left,
rgba(226, 221, 225, 10),
rgba(226, 221, 225, 10),
rgba(226, 221, 225, 0.2)
),
url("https://images-na.ssl-images-amazon.com/images/I/61fZ%2BYAYGaL._SX569_.jpg")
no-repeat;
background: -o-linear-gradient(
left,
rgba(226, 221, 225, 10),
rgba(226, 221, 225, 10),
rgba(226, 221, 225, 0.2)
),
url("https://images-na.ssl-images-amazon.com/images/I/61fZ%2BYAYGaL._SX569_.jpg")
no-repeat;
background: linear-gradient(
to right,
rgba(226, 221, 225, 10),
rgba(226, 221, 225, 10),
rgba(226, 221, 225, 0.2)
),
url("https://images-na.ssl-images-amazon.com/images/I/61fZ%2BYAYGaL._SX569_.jpg")
no-repeat;
/* background-size: contain;*/
background-attachment: fixed;
background-position: right;
}
/*
html {
min-height: 100%;
background-image: url(image.jpg);
background-size: cover;
background-repeat: no-repeat;
background-position: center center;
}*/
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
a,
a:visited,
a:hover,
a:focus,
a:active {
text-decoration: none;
}
a {
color: var(--brown-color);
cursor: pointer;
}
.navbar {
margin: 0 auto;
max-width: 1800px;
width: 89%;
padding-top: 2px;
display: flex;
align-items: center;
font-family: "brownregular";
font-size: 1.2rem;
}
.nav-items {
display: flex;
margin: 0px 20px;
width: 86%;
align-items: center;
letter-spacing: 0.5px;
}
.nav-logo {
height: 82px;
width: 80px;
}
.nav1,
.nav2,
.nav3 {
margin: 5px 40px;
}
.nav3 {
flex-grow: 1;
}
.middle {
flex-grow: 2;
}
.ig {
margin-right: 50px;
}
.ig,
.fb {
height: 25px;
width: 23px;
vertical-align: middle;
}
.nav4-button {
display: flex;
background-color: #a82534;
width: 8em;
height: 2.8em;
border-radius: 4px;
align-items: center;
justify-content: center;
cursor: pointer;
}
.nav4 {
margin-left: 0 auto;
}
.white-text {
color: white;
}
.primary-header-container {
padding-top: 6.5rem;
display: inline-block;
}
.primary-header {
margin-bottom: 0.2em;
}
.sub-header-container {
padding-top: 2.3em;
}
.sub-header {
font-size: 1.35rem;
}
.desc {
margin-bottom: 0.7em;
}
.underline {
border-bottom: solid 10px #73353c;
width: fit-content;
}
ul,
li,
.desc-link {
list-style-type: none;
color: #a89da7;
}
.hero-section {
max-width: 1800px;
width: 77%;
margin: 0 auto;
}
h1 {
font-family: "jelleebold";
font-size: 5rem;
color: white;
margin-top: 5px;
}
p {
font-family: "brownlight";
}
.section-bg-color {
background-color: #f4f3f4;
padding: 135px 0px;
}
.card_container {
display: flex;
justify-content: space-between;
max-width: 1590px;
width: 78.5%;
margin: 0 auto;
}
.card {
width: 370px;
/* Set width of cards */
height: 370px;
display: flex;
/* Children use Flexbox */
flex-direction: column;
/* Rotate Axis */
background-color: white;
overflow: hidden;
/* Fixes the corners */
}
.card-header {
color: #d32f2f;
text-align: center;
font-size: 12px;
font-weight: 600;
background-color: inherit;
padding: 5px 10px;
}
.card-main {
display: flex;
/* Children use Flexbox */
flex-direction: column;
/* Rotate Axis to Vertical */
justify-content: center;
/* Group Children in Center */
align-items: center;
/* Group Children in Center (on cross axis) */
padding: 15px 0;
/* Add padding to the top/bottom */
}
.material-icons {
font-size: 36px;
color: #d32f2f;
margin-bottom: 5px;
}
.main-description {
color: #d32f2f;
font-size: 12px;
text-align: center;
}
.sectioncampaign-bg-color {
background-color: #e5dfe3;
padding: 150px 0px;
}
.sectioncampaign-container {
width: 1392px;
margin: 0 auto;
}
h2 {
font-size: 2.8em;
font-family: "jelleebold";
color: white;
}
.body {
font-size: 1.5em;
padding-top: 45px;
width: 55%;
line-height: 40px;
}
<main>
<div class="navbar">
<div class="logo">
<img class="nav-logo" src="https://i.imgur.com/HAWAwVg.png" alt="cat laying down logo" /> </div>
<div class="nav-items">
<div class="nav1">About us</div>
<div class="nav2">Shop</div>
<div class="nav3">Get involved</div>
<div class="social-icons middle">
<img class="ig" src="https://i.imgur.com/UTO8Ake.png" alt="instagram icon link" />
<img class="fb" src="https://i.imgur.com/UTO8Ake.png" alt="instagram icon link" />
</div>
<a href="nav4.html" class="nav4-button">
<div class="nav4"><span class="white-text">Support</span> </div>
</a>
<!-- <div class="services">Services</div>-->
</div>
</div>
<!-- /header -->
</main>
https://codepen.io/ninabor/pen/ExKMqrm
max-width: 1800px;
width: 90%;
padding-top: 2px;
display: flex;
align-items: center;
font-family: "brownregular";
font-size: 1.2rem;
margin: 0 auto;
}
.nav-items {
display: flex;
align-items: center;
letter-spacing: 0.5px;
width:100%;
}
I fixed it by adding 100% width to items and 90% to navbar
Please could somebody help me with flex for pushing my footer down / expanding the content to fit?
https://jsfiddle.net/9xjy78gj/
Hopefully it's clear to see from the site what my issue is.
I'd just like to use flex to push the footer down and expand the content div appropriately, without using set heights for the content div etc. if possible?
Many thanks!
HTML
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<div id="page_wrap">
<header>
<a href="/">
<h1>Close<span><i class="fa fa-map-marker" aria-hidden="true"></i></span>Range</h1>
</a>
<hr />
</header>
<div id="refinement">
<form>
<div class="form_component">
<select id="narrow">
<option value="select" selected disabled>Please Select</option>
</select>
</div>
<div class="form_component">
<input id="driving" type="radio" name="travelmode" value="Driving" checked /> <i class="fa fa-car" aria-hidden="true"></i>
</div>
<div class="form_component">
<input id="walking" type="radio" name="travelmode" value="Walking" /> <i class="fa fa-male" aria-hidden="true"></i>
</div>
</form>
</div>
<div id="jquery_placeholder">
<!-- JQuery loads PHP output into here-->
</div>
<div id="place_results_wrap">
<!-- and here -->
<div id="content">
<h2>Let's explore!</h2>
<i class="fa fa-globe" aria-hidden="true"></i>
</div>
</div>
<footer class="footer">
<div id="google">
<img src="/assets/i/google.png" alt="Powered by Google" />
</div>
</footer>
</div>
</body>
</html>
CSS
a, a:hover
{
text-decoration: none;
}
body
{
font-family: 'Open Sans', sans-serif;
background: #ECECEA;
font-size:16px;
}
#page_wrap
{
width:100%;
}
header
{
background: #fff;
text-align: center;
padding: 1.250em;
}
header h1
{
font-size: 6em;
font-weight: 400;
color: #655e5e;
margin: 0;
display: inline-block;
}
#media screen and (max-width: 550px)
{
header h1 {
font-size: 3em;
}
}
header hr
{
max-width: 36em;
margin-bottom: 0px;
}
header .fa-map-marker
{
color: #ec3b3b;
font-size: 1.2em;
}
#refinement
{
padding: 0.5em 1.25em 1.25em;
display: flex;
align-items: center;
justify-content: center;
background: #fff;
}
#refinement form
{
display: flex;
justify-content: center;
}
.form_component
{
margin: 0 0.4em;
display: none;
}
.form_component i.fa
{
font-size: 1.4em;
color: #655e5e;
}
#content
{
text-align: center;
background: #655e5e;
padding: 1.25em;
}
#content h2
{
color: #fff;
font-weight: 400;
font-size: 4em;
margin: 0;
}
#media screen and (max-width: 415px) {
#content h2
{
font-size:2em;
}
}
#content i.fa-globe
{
font-size: 18em;
color: #fff;
}
.place_results
{
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: center;
padding: 1.25em 0;
}
.next_page
{
padding: 0 1.250em;
width: 100%;
text-align: center;
}
.next_page button
{
background-color: #fff;
border: none;
color: #655e5e;
padding: 0.3125em 2em;
text-decoration: none;
display: inline-block;
font-size: 1em;
font-weight: 600;
cursor: pointer;
border-radius: 1.25em;
}
.next_page button:hover
{
background-color: #f6f6f6;
}
.place
{
width: 24em;
height: 27em;
margin: 1.25em;
display: flex;
flex-direction: column;
-webkit-box-shadow: 5px 6px 20px 0px rgba(158,155,158,0.75);
-moz-box-shadow: 5px 6px 20px 0px rgba(158,155,158,0.75);
box-shadow: 5px 6px 20px 0px rgba(158,155,158,0.75);
background: #fff;
}
#media screen and (max-width: 1920px) {
.place
{
width: 30%;
}
}
#media screen and (min-width: 900px)
and (max-width: 1366px){
.place
{
width: 45%;
}
}
#media screen and (min-width: 768px)
and (max-width: 1366px){
.place
{
width: 44%;
}
}
#media screen and (min-width: 415px)
and (max-width: 760px){
.place
{
width: 90%;
}
}
#media screen and (max-width: 415px) {
.place
{
width: 90%;
}
}
.place_image
{
width: 100%;
height: 14.0625em;
background-size: cover !important;
background-clip: content-box !important;
}
.place_description
{
padding: 0.625em;
display: flex;
flex-direction: column;
flex: 1 1 0;
background: #fff;
}
.distance_container p.distance
{
font-weight:600;
}
.place_description p, .place_description a
{
color: #655e5e;
font-weight: 400;
margin: 0;
}
.place_description .place_open p
{
margin: 0;
color: #49b51c;
}
.place_description i.fa
{
width: 1.25em;
}
.place_title
{
flex: 1 1 0;
}
.place_title h3
{
color: #655e5e;
font-weight: 600;
white-space: nowrap;
overflow: hidden;
margin: 0;
font-size: 1.4em;
line-height: 1.3;
}
#media screen and (max-width: 415px) {
.place_title h3
{
font-size: 1.2em;
}
}
.rating_container
{
width: 100%;
}
.rating_bar {
width: 6.875em;
height: 1.313em;
background: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/2605/star-rating-sprite.png);
background-repeat: repeat-x;
background-position: 0 0;
}
.rating {
height: 1.313em;
background: url(https://s3-us-west-2.amazonaws.com/s.cdpn.io/2605/star-rating-sprite.png);
background-position: 0 100%;
background-repeat: repeat-x;
}
.place_description .place_location
{
margin-bottom: 0.625em;
}
.place .distance_container, .place .vicinity_container, .place .place_phone_container
{
display: flex;
}
#load_container
{
padding: 1.25em;
text-align: center;
}
#load i.fa-spin
{
font-size: 4em;
color: #ec3b3b;
}
#jquery_placeholder
{
display:none;
width:100%;
}
footer
{
padding: 1.25em;
text-align: right;
background: #fff;
}
footer #google img
{
width: 10em;
}
#error
{
padding: 1.25em;
background: #ec3b3b;
}
#error p
{
font-size: 1.2em;
margin: 0;
color: #fff;
text-align: center;
}
#error i.fa-exclamation-circle
{
color: #fff;
}
Flexbox can do that providing you use flex-direction:column like so:
If you don't want sections to expand to take up spare space, just remove the flex:1.
html,
body {
height: 100%;
}
body {
min-height: 100%;
text-align: center;
/* for demo */
}
.page-wrap {
min-height: 100%;
display: flex;
flex-direction: column;
}
header {
background: pink;
}
footer {
background: rebeccapurple;
color: #fff;
}
aside {
flex: 1;
background: orange;
}
main {
flex: 1;
background: grey;
}
<div class="page-wrap">
<header>
<h1>Header</h1>
</header>
<aside>I'm a secondary header</aside>
<main>I'm main content</main>
<footer>
<h1>Footer</h1>
</footer>
</div>