screenshotI'm quite new to coding. I have this responsive width problem which is probably a simple solution but I can't yet find. Every time I reduce the screen past around 580px the layout reduces at twice the rate of the viewport, leaving me with half of my project on the left and whitespace on the right.
Can someone please help me?
* {
padding: 0;
margin: 0;
box-sizing: border-box;
font-family: 'Poppins', sans-serif;
}
.clear {
clear: both;
}
body {
line-height: 1.5;
background-color: whitesmoke;
}
.width-container {
width: 80%;
margin: auto;
}
/* Responsive */
#media(max-width: 1100px) {
.flex-form-container {
flex-direction: column;
align-items: center;
}
.flex-list-and-images-container {
flex-direction: column;
align-items: center;
}
.why-me-list {
width: 60%;
}
.flex-reviews {
flex-direction: column;
padding: 4em;
}
.quote1 {
top: 20%;
}
.quote2 {
top: 40%;
}
.quote3 {
top: 62.5%
}
}
#media screen and (max-width: 768px) {
.flex-header-container {
flex-direction: column;
align-items: center;
}
.flexbox-1 {
order: 1;
}
.flexbox-2 {
order: 3;
}
.flexbox-3 {
order: 2;
}
/*
.contact-message {
float: none;
}
.contact-numbers {
float: none;
}
*/
.width-container {
width: 100%;
}
.nav-tab {
display: block;
}
}
/*
#media screen and (max-width: 580px) {
body {
position: absolute;
}
}
*/
/* Header */
header {
background-image: url(Images/jaye-haych-7tkDoo2L_Eg-unsplash.jpg);
background-position: center;
background-size: cover;
}
.flex-header-container {
display: -webkit-flex;
display: -moz-flex;
display: -ms-flex;
display: -o-flex;
display: flex;
justify-content: space-between;
}
.flex-header-container div {
padding: 0.5em;
margin: 0.5em;
}
.flexbox-1 {
flex-basis: 33%;
}
.flexbox-2 {
background-color: rgb(255, 255, 255);
flex-basis: 22.5%;
border-radius: 10px;
display: flex;
flex-direction: column-reverse;
align-items: center;
}
.flexbox-2 .ncfe {
margin: 1.4em;
padding: em;
}
.flexbox-2 .CG {
margin:
}
.flexbox-3 {
flex-basis: 33%;
color: white;
text-shadow: 1px 1px 1px black;
font-family: 'Satisfy', cursive;
}
.flexbox-3 h4 {
font-size: 2.5em;
padding: 0.3em;
text-align: center;
font-style: italic;
font-family: 'Satisfy', cursive;
}
.flexbox-3 span {
display: block;
text-align: center;
font-size: 1.35em;
}
.logo {
width: 165px;
height: 220px;
}
.CG {
width: 130px;
}
.ncfe {
width: 100px;
}
/* Nav section */
nav {
text-align: center;
background-color: #1A98BE;
color: white;
padding: 0.7em;
border-top: 1px solid black;
border-bottom: 1px solid black;
}
.nav-tab {
display: inline-block;
margin: 0.5em;
padding: 0.4em;
font-size: 1.5em;
text-shadow: 1px 1px 1px black;
background-color: #F3CA4F;
border-radius: 10px;
box-shadow: 0.5px 0.5px 0.5px 0.5px black;
text-transform: uppercase;
}
nav ul li a {
text-decoration: none;
color: white;
font-style: italic;
transition: 1.5s;
}
nav ul li a:hover {
color: #E85522;
font-size: 2em;
}
/* About Section */
.about {
}
h1 {
padding: 1em;
font-size: 4.4em;
background-color: #E85522;
color: white;
text-shadow: 5px 1px 1px black;
text-align: center;
font-style: italic;
font-family: 'Satisfy', cursive;
border-radius: 0 0 5px 5px;
box-shadow: 1px 1px 1px 1px black;
transition: 1.5s;
}
.why-choose-me {
padding: 1em;
font-size: 2.3em;
background-color: #E85522;
color: white;
text-shadow: 3px 1px 1px black;
font-family: 'Satisfy', cursive;
border-radius: 5px;
box-shadow: 1px 1px 1px 1px black;
font-style: italic;
}
.about p {
padding: 1.5em;
font-size: 1.2em;
}
/* Why Me Section */
.flex-list-and-images-container {
display: flex;
justify-content: space-around;
}
.why-me-images {
display: flex;
flex-basis: 30%;
justify-content: center;
align-self: center;
/* border: 1px solid black;*/
}
.why-me-images .ncfe {
margin-left: 1em;
margin-top: 1em;
width: 100%;
height: 7em;
}
.why-me-list {
flex-basis: 40%;
margin: 2em;
padding: 1em;
border: 1px solid black;
background-color: #B0B0B3;
color: white;
border-radius: 5px;
box-shadow: 1px 1px 1px black;
}
.why-me-item {
padding: 1em;
list-style-type: none;
text-shadow: 1px 1px 1px black;
font-size: 1.2em;
}
.why-me-item:before {
content: '✓';
padding: 0.3em;
}
/* Reviews */
.flex-reviews {
border: 1px solid black;
display: flex;
justify-content: space-around;
background-image: url(Images/amol-tyagi-TUbhfdomGsY-unsplash.jpg);
background-position: center;
background-size: cover;
align-items: center;
}
.customer-review {
font-size: 1.4em;
flex-basis: 30%;
text-align: center;
color: white;
text-shadow: 1px 1px 1px black;
padding: 2.5em;
}
.reviews h2 {
padding: 1em;
background-color: #E85522;
color: white;
font-family: 'Satisfy', cursive;
font-style: italic;
font-size: 2.2em;
text-align: center;
text-shadow: 1px 1px 1px black;
}
.reviews {
position: relative;
}
.reviews-button {
padding: 0.4em;
cursor: pointer;
background-color: #B0B0B3;
color: white;
display: block;
text-align: center;
font-size: 1.4em;
font-style: italic;
transition: 1s;
text-shadow: 1px 1px 1px black;
}
.reviews-button:hover {
color: #E85522;
font-size: 1.5em;
text-shadow: 0.5px 0.5px 0.5px black;
}
.quote1 {
position: absolute;
bottom: 60%;
left: 14%;
text-shadow: 2px 2px 2px black;
}
.quote2 {
position: absolute;
bottom: 60%;
left: 48%;
text-shadow: 2px 2px 2px black;
}
.quote3 {
position: absolute;
bottom: 60%;
left: 80%;
text-shadow: 2px 2px 2px black;
}
/* Contact */
.contact {
padding: 4em;
border: 1px solid black;
background-color: #E85522;
color: white;
}
.contact-message {
float: left;
width: 60%;
padding: 1em;
text-align: center;
}
.contact-message p {
font-size: 3.8vw;
}
.contact-heading {
font-size: 3em;
text-shadow: 1px 1px 1px black;
padding: 0.3em;
font-family: 'Satisfy', cursive;
font-style: italic;
}
.contact-numbers {
float: left;
padding: 1em;
width: 31%;
text-align: center;
}
.contact-numbers p {
font-size: 2.8em;
}
/* Form */
form {
padding: 5em;
text-align: center;
}
.flex-form-container {
display: flex;
justify-content: space-around;
background-image: url(Images/maria-ziegler-jJnZg7vBfMs-unsplash.jpg);
background-size: cover;
background-position: center;
}
.form-left {
flex-basis: 50%;
}
.form-right {
flex-basis: 30%;
padding: 5em;
}
.form-right h3 {
color: white;
font-size: 3em;
text-shadow: 1px 1px 1px black;
text-align: center;
padding: 0.4em;
font-family: 'Satisfy', cursive;
font-style: italic;
}
.form-right p {
text-align: center;
font-size: 1.4em;
text-decoration: underline;
text-shadow: 0.5px 0.1px black;
font-style: italic;
}
.form-right p a {
color: #1A98BE;
}
.form-right p a:hover {
color: white;
text-shadow: 2px 1px 1px black;
}
input {
display: inline-block;
padding: 0.6em;
margin: 0.2em;
font-size: 1em;
border-radius: 5px;
}
input[type="submit"] {
color: #1A98BE;
transition: 0.5s;
cursor: pointer;
}
input[type="submit"]:hover {
color: #E85522;
font-size: 1.5em;
box-shadow: 1px 1px 1px 1px black;
}
textarea {
display: inline-block;
padding: 0.4em;
margin: 1em;
width: 373px;
font-size: 1.6em;
border-radius: 5px;
}
/* Footer */
footer {
border: 1px solid black;
text-align: center;
padding: 1em;
background-color: #B0B0B3;
color: white;
}
footer > * {
padding: 0.4em;
}
footer p a {
color: #E85522;
}
.fa {
padding: 1em;
transition: 1s;
color: #E85522;
}
.fa:hover {
color: white;
font-size: 25px;
}
https://codepen.io/jared-parsons/pen/LYGexBY?editors=1100
I think I found a solution:
html, body {
max-width: 100%;
overflow-x: hidden;
}
Got rid of the ugly whitespace and scroll bar.
As I understood from your question, that you having an issue with the dimension of the page. If this is the issue, have tried to use % or ration to indicate the dimension of the page or the layout?
I am wondering why I can't move my .workButton to the center :D? I have tried text-align, or margin:0 auto, but nothing seems to work...
If you see some mistakes/or something that could be done differently, let me know, please!
Any tips would be really helpful!
Here is the link to the code (i wrote it in scss)
* {
margin: 0;
padding: 0; // box-sizing: border-box;
}
body {
font-family: "Titillium Web", sans-serif;
}
.container {
max-width: 1140px;
width: 100vw;
height: 100vh;
margin: 0 auto;
overflow: hidden; // grid-template-rows: 600px 750px 900px 650px 1420px 900px 820px 100px;
}
#hero {
max-height: 600px;
height: 100vh;
background-color: #87509c;
h1 {
text-align: center;
color: #f7f3ea;
font-size: 42px;
line-height: 50px;
margin-top: 140px;
margin-bottom: 60px;
}
.workButton {
text-align: center;
font-size: 18px;
font-weight: 600;
color: #ffffff;
padding: 20px 80px;
text-transform: uppercase;
text-decoration: none;
border: 1px solid #eb7d4b;
border-radius: 5px;
background-color: #eb7d4b;
box-shadow: 0 2px #c86a40;
}
}
.navbar {
display: flex;
margin: 60px 20px 20px 40px;
ul {
margin-left: auto;
list-style-type: none;
align-self: center;
li {
float: left;
a {
text-decoration: none;
color: #ffffff;
padding: 5px 20px;
text-transform: uppercase;
transition-duration: 1.5s;
}
a:hover {
background-color: #643a79;
border-radius: 3px;
transition-duration: .4s;
}
}
}
}
https://codepen.io/anon/pen/ZvXZLe
Apply text-align: center to your #hero wrapper and your link will center just fine.
The <a></a> does'nt has specific width. So, just add on .workButton,
#hero {
.workButton {
width: 100px;
text-align: center;
}
}
That's it...Thank You...
Here is my JSFiddle...https://jsfiddle.net/5xt7pt7f/
I get that there is a lot going on here, I will try to isolate my issue as best as possible.
There are two parent wrappers...
<div class="video-section">
...
<div class="chat-section">
As you can see in the fiddle, their height is not 100%, it seems to have some sort of max-height because they do not always fill the page. My html structure is something like...
<div id="app">
...
<div class="chat-navbar">....</div>
<div class="chat-wrapper">
<div class="video-section">
<div class="chat-section">
...
#app is the main container. I want .chat-navbar to be at the top and the .chat-wrapper to be below it. I accomplished this through...
div#app {
display: flex;
flex: 1;
flex-direction: column; }
Next I wanted .video-section and .chat-section to be side by side, I accomplished this through...
.chat-wrapper {
display: flex;
flex: 1;
flex-direction: row;
}
However, these two wrappers do not fill the height of the page. I do not care if the canvas elements inside fill the page, but I do need the parent wrappers to fill up the page.
This is what it look like on my local...
As you can see there is a lot of white space at the bottom because the elements do not have full height. I thought flex:1 would have resolved this.
Try using display:flex; on the div containing chat-navbar and chat-wrapper (I gave it id="chatcon") and then use flex-grow:1; on chat-wrapper. I commented one of the canvases and changed navbar color to red, to help notice the difference.
Here's a codepen
body, html {
margin: 0;
font-family: 'Libre Baskerville', serif; }
#chatcon{
min-height:100vh;
display:flex;
flex-direction:column;
}
a {
text-decoration: none;
margin: 5px; }
a:active, a:visited {
color: inherit; }
.chat-wrapper {
display: flex;
flex: 1;
flex-direction: row;
}
.chat-section {
border: none;
border-left: 1px solid #ccc;
box-sizing: border-box;
padding-left: 0.5em;
display: flex;
flex: 1;
flex-direction: column;
margin-left: 5px; }
div#app {
display: flex;
flex: 1;
flex-direction: column; }
.chat-section ul {
overflow-y: auto;
flex: 1;
margin-bottom: 0;
padding-left: 0.5em; }
.chat-section ul li {
text-decoration: none;
list-style-type: none; }
.chat-section ul li + li {
margin-top: 7px; }
.chat-section textarea {
resize: none;
border: none;
border-top: 1px solid #ccc;
box-sizing: border-box;
margin-left: -0.5em; }
.chat-section textarea:focus {
outline: none;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none; }
.video-section {
display: flex;
flex: 1;
text-align: center; }
.videos {
flex: 1;
display: flex;
max-width: 800px;
flex-direction: column;
align-content: stretch; }
.chat-navbar {
border-left: 1px solid #ccc;
box-sizing: border-box;
padding-top: 1em;
display: flex;
flex: 1; }
.localCanvas, .remoteCanvas {
background-color: black;
margin-left: 5px;
margin-right: 5px;
-webkit-box-shadow: 9px 5px 17px -6px rgba(0, 0, 0, 0.75);
-moz-box-shadow: 9px 5px 17px -6px rgba(0, 0, 0, 0.75);
box-shadow: 9px 5px 17px -6px rgba(0, 0, 0, 0.75); }
.localCanvas {
margin-top: 5px;
margin-bottom: 5px; }
canvas.remoteCanvas {
margin-top: 5px; }
.auth-container {
display: flex;
justify-content: center;
align-items: center;
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
flex-direction: column;
background: #004FF9;
/* For browsers that do not support gradients */
background: -webkit-linear-gradient(to right, #FFF94C, #004FF9);
/* For Safari 5.1 to 6.0 */
background: -o-linear-gradient(to right, #FFF94C, #004FF9);
/* For Opera 11.1 to 12.0 */
background: -moz-linear-gradient(to right, #FFF94C, #004FF9);
/* For Firefox 3.6 to 15 */
background: linear-gradient(to right, #FFF94C, #004FF9);
/* Standard syntax */
background-size: cover; }
.loginForm, .registerForm {
width: 500px;
height: 600px;
display: block;
margin-left: auto;
margin-right: auto;
position: absolute;
top: 130px;
left: 0;
right: 0; }
.loginWrap {
width: 500px;
float: left;
height: 100%;
background: rgba(255, 255, 255, 0.75);
-webkit-box-shadow: 4px 3px 14px -5px rgba(0, 0, 0, 0.75);
-moz-box-shadow: 4px 3px 14px -5px rgba(0, 0, 0, 0.75);
box-shadow: 4px 3px 14px -5px rgba(0, 0, 0, 0.75); }
.bodyLogin {
overflow: hidden;
height: 100%; }
.bg_image {
height: 1000px;
width: 100%; }
h1 {
font-family: 'Roboto', sans-serif;
color: #87909c;
font-weight: bolder;
text-align: center;
font-size: 1.5em;
margin-top: 20px; }
img.logo_image {
width: 500px; }
img.title_image {
width: 200px;
margin-left: auto;
display: block;
margin-right: auto;
margin-top: -90px; }
label {
font-size: 12px;
font-weight: bold;
color: #87909c;
float: left;
clear: both;
font-family: 'Roboto', sans-serif;
margin-left: 30px;
margin-top: 15px; }
input[type="text"], input[type="password"] {
float: left;
margin-top: 15px;
clear: both;
margin-left: 30px;
font-size: 1.3em;
width: 80%;
outline: none;
border: none;
padding: 10px;
padding-left: 10px; }
.login_btn, .register_btn {
float: left;
clear: left;
font-family: 'Roboto', sans-serif;
background: #7289da;
border: solid 1px #7289da;
width: 84%;
margin-left: 30px;
margin-top: 50px;
padding: 20px;
border-radius: 5px;
font-size: 1em;
color: white;
cursor: pointer; }
.registerLinkWrap, .loginLinkWrap {
float: left;
clear: left;
margin-left: 30px; }
a.register_link, a.login_link {
float: left;
margin-top: 11px;
font-size: 13px;
color: black;
font-family: 'Roboto', sans-serif; }
a.register_link:hover, a.login_link:hover {
text-decoration: underline; }
p.register_sentence, p.login_sentence {
clear: left;
float: left;
font-size: 12px;
color: #3e4956;
font-family: 'Roboto', sans-serif; }
.errUsername, .errPassword, .errRegister {
float: left;
margin-left: 30px;
margin-top: 3px;
color: red;
font-size: 0.8em;
font-family: 'Roboto', sans-serif; }
.reg_success {
position: absolute;
background: #f2fae3;
width: 100%;
text-align: center;
padding: 10px;
font-family: 'Roboto', sans-serif;
color: #94b639;
border-bottom: solid 3px #94b639; }
.reg_neutral {
display: none; }
/*# sourceMappingURL=styles.css.map*/
.chat-navbar{
flex-shrink:0;
flex-grow:0;
height:70px;
background-color:red;
}
<div id="app">
<div id="chatcon" data-reactroot="">
<div class="chat-navbar">
Logout
</div>
<div class="chat-wrapper">
<div class="video-section">
<div class="videos">
<canvas class="remoteCanvas" width="320" height="240"></canvas>
<!-- <canvas class="localCanvas" width="320" height="240"></canvas> -->
</div>
</div>
<div class="chat-section">
<ul>No messages</ul>
<textarea placeholder="Type a message" rows="2"></textarea>
</div>
</div></div></div>
To simplify your requirement, add relative heights wherever required so that your wrappers occupy the entirety of the page.
Give html, body { height: 100%; } which resolves the majority of issues and then further on.
Created a fiddle for you: https://jsfiddle.net/nashcheez/u7bmL0nm/
body,
html {
margin: 0;
font-family: 'Libre Baskerville', serif;
height: 100%;
}
a {
text-decoration: none;
margin: 5px;
}
a:active,
a:visited {
color: inherit;
}
.chat-wrapper {
display: flex;
flex: 1;
flex-direction: row;
height: 100%;
}
.chat-section {
border: none;
border-left: 1px solid #ccc;
box-sizing: border-box;
padding-left: 0.5em;
display: flex;
flex: 1;
flex-direction: column;
margin-left: 5px;
}
div#app {
display: flex;
flex: 1;
flex-direction: column;
height: 100%;
}
.chat-section ul {
overflow-y: auto;
flex: 1;
margin-bottom: 0;
padding-left: 0.5em;
}
.chat-section ul li {
text-decoration: none;
list-style-type: none;
}
.chat-section ul li + li {
margin-top: 7px;
}
.chat-section textarea {
resize: none;
border: none;
border-top: 1px solid #ccc;
box-sizing: border-box;
margin-left: -0.5em;
}
.chat-section textarea:focus {
outline: none;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
}
.video-section {
display: flex;
flex: 1;
text-align: center;
}
.videos {
flex: 1;
display: flex;
max-width: 800px;
flex-direction: column;
align-content: stretch;
}
.chat-navbar {
border-left: 1px solid #ccc;
box-sizing: border-box;
padding-top: 1em;
display: flex;
flex: 1;
}
.localCanvas,
.remoteCanvas {
background-color: black;
margin-left: 5px;
margin-right: 5px;
-webkit-box-shadow: 9px 5px 17px -6px rgba(0, 0, 0, 0.75);
-moz-box-shadow: 9px 5px 17px -6px rgba(0, 0, 0, 0.75);
box-shadow: 9px 5px 17px -6px rgba(0, 0, 0, 0.75);
height: 50%;
}
.localCanvas {
margin-top: 5px;
margin-bottom: 5px;
}
canvas.remoteCanvas {
margin-top: 5px;
}
.auth-container {
display: flex;
justify-content: center;
align-items: center;
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
flex-direction: column;
background: #004FF9;
/* For browsers that do not support gradients */
background: -webkit-linear-gradient(to right, #FFF94C, #004FF9);
/* For Safari 5.1 to 6.0 */
background: -o-linear-gradient(to right, #FFF94C, #004FF9);
/* For Opera 11.1 to 12.0 */
background: -moz-linear-gradient(to right, #FFF94C, #004FF9);
/* For Firefox 3.6 to 15 */
background: linear-gradient(to right, #FFF94C, #004FF9);
/* Standard syntax */
background-size: cover;
}
.loginForm,
.registerForm {
width: 500px;
height: 600px;
display: block;
margin-left: auto;
margin-right: auto;
position: absolute;
top: 130px;
left: 0;
right: 0;
}
.loginWrap {
width: 500px;
float: left;
height: 100%;
background: rgba(255, 255, 255, 0.75);
-webkit-box-shadow: 4px 3px 14px -5px rgba(0, 0, 0, 0.75);
-moz-box-shadow: 4px 3px 14px -5px rgba(0, 0, 0, 0.75);
box-shadow: 4px 3px 14px -5px rgba(0, 0, 0, 0.75);
}
.bodyLogin {
overflow: hidden;
height: 100%;
}
.bg_image {
height: 1000px;
width: 100%;
}
h1 {
font-family: 'Roboto', sans-serif;
color: #87909c;
font-weight: bolder;
text-align: center;
font-size: 1.5em;
margin-top: 20px;
}
img.logo_image {
width: 500px;
}
img.title_image {
width: 200px;
margin-left: auto;
display: block;
margin-right: auto;
margin-top: -90px;
}
label {
font-size: 12px;
font-weight: bold;
color: #87909c;
float: left;
clear: both;
font-family: 'Roboto', sans-serif;
margin-left: 30px;
margin-top: 15px;
}
input[type="text"],
input[type="password"] {
float: left;
margin-top: 15px;
clear: both;
margin-left: 30px;
font-size: 1.3em;
width: 80%;
outline: none;
border: none;
padding: 10px;
padding-left: 10px;
}
.login_btn,
.register_btn {
float: left;
clear: left;
font-family: 'Roboto', sans-serif;
background: #7289da;
border: solid 1px #7289da;
width: 84%;
margin-left: 30px;
margin-top: 50px;
padding: 20px;
border-radius: 5px;
font-size: 1em;
color: white;
cursor: pointer;
}
.registerLinkWrap,
.loginLinkWrap {
float: left;
clear: left;
margin-left: 30px;
}
a.register_link,
a.login_link {
float: left;
margin-top: 11px;
font-size: 13px;
color: black;
font-family: 'Roboto', sans-serif;
}
a.register_link:hover,
a.login_link:hover {
text-decoration: underline;
}
p.register_sentence,
p.login_sentence {
clear: left;
float: left;
font-size: 12px;
color: #3e4956;
font-family: 'Roboto', sans-serif;
}
.errUsername,
.errPassword,
.errRegister {
float: left;
margin-left: 30px;
margin-top: 3px;
color: red;
font-size: 0.8em;
font-family: 'Roboto', sans-serif;
}
.reg_success {
position: absolute;
background: #f2fae3;
width: 100%;
text-align: center;
padding: 10px;
font-family: 'Roboto', sans-serif;
color: #94b639;
border-bottom: solid 3px #94b639;
}
.reg_neutral {
display: none;
}
<div id="app">
<div style="height: 100%;" data-reactroot="">
<div class="chat-navbar">
Logout
</div>
<div class="chat-wrapper">
<div class="video-section">
<div class="videos">
<canvas class="remoteCanvas" width="320" height="240"></canvas>
<canvas class="localCanvas" width="320" height="240"></canvas>
</div>
</div>
<div class="chat-section">
<ul>No messages</ul>
<textarea placeholder="Type a message" rows="2"></textarea>
</div>
</div>
</div>
</div>
I see that you gave div#app both display: flex and flex: 1. Do note that the flex: 1 does not do anything here, it is a flex child property.
So for div#app to fill page it need a height, here given min-height: 100vh. Now you can give for example the <div data-reactroot> element flex: 1 to fill its parent (light blue).
Any child having a parent with display: flex; flex-direction: column only need flex: 1 to fill vertical space, if it has flex-direction: row it will need a height, where height: 100% normally work.
These 2 rules shows how to
div#app {
display: flex;
flex-direction: column;
min-height: 100vh;
}
div[data-reactroot] {
flex: 1;
background: lightblue;
}
Hope this makes it clear how it works, and from here you can apply the same logic your way down in the markup.
body,
html {
margin: 0;
font-family: 'Libre Baskerville', serif;
}
a {
text-decoration: none;
margin: 5px;
}
a:active,
a:visited {
color: inherit;
}
.chat-wrapper {
display: flex;
flex: 1;
flex-direction: row;
}
.chat-section {
border: none;
border-left: 1px solid #ccc;
box-sizing: border-box;
padding-left: 0.5em;
display: flex;
flex: 1;
flex-direction: column;
margin-left: 5px;
}
div#app {
display: flex;
flex-direction: column;
min-height: 100vh;
}
div[data-reactroot] {
flex: 1;
background: lightblue;
}
.chat-section ul {
overflow-y: auto;
flex: 1;
margin-bottom: 0;
padding-left: 0.5em;
}
.chat-section ul li {
text-decoration: none;
list-style-type: none;
}
.chat-section ul li + li {
margin-top: 7px;
}
.chat-section textarea {
resize: none;
border: none;
border-top: 1px solid #ccc;
box-sizing: border-box;
margin-left: -0.5em;
}
.chat-section textarea:focus {
outline: none;
-webkit-box-shadow: none;
-moz-box-shadow: none;
box-shadow: none;
}
.video-section {
display: flex;
flex: 1;
text-align: center;
}
.videos {
flex: 1;
display: flex;
max-width: 800px;
flex-direction: column;
align-content: stretch;
}
.chat-navbar {
border-left: 1px solid #ccc;
box-sizing: border-box;
padding-top: 1em;
display: flex;
flex: 1;
}
.localCanvas,
.remoteCanvas {
background-color: black;
margin-left: 5px;
margin-right: 5px;
-webkit-box-shadow: 9px 5px 17px -6px rgba(0, 0, 0, 0.75);
-moz-box-shadow: 9px 5px 17px -6px rgba(0, 0, 0, 0.75);
box-shadow: 9px 5px 17px -6px rgba(0, 0, 0, 0.75);
}
.localCanvas {
margin-top: 5px;
margin-bottom: 5px;
}
canvas.remoteCanvas {
margin-top: 5px;
}
.auth-container {
display: flex;
justify-content: center;
align-items: center;
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
flex-direction: column;
background: #004FF9;
/* For browsers that do not support gradients */
background: -webkit-linear-gradient(to right, #FFF94C, #004FF9);
/* For Safari 5.1 to 6.0 */
background: -o-linear-gradient(to right, #FFF94C, #004FF9);
/* For Opera 11.1 to 12.0 */
background: -moz-linear-gradient(to right, #FFF94C, #004FF9);
/* For Firefox 3.6 to 15 */
background: linear-gradient(to right, #FFF94C, #004FF9);
/* Standard syntax */
background-size: cover;
}
.loginForm,
.registerForm {
width: 500px;
height: 600px;
display: block;
margin-left: auto;
margin-right: auto;
position: absolute;
top: 130px;
left: 0;
right: 0;
}
.loginWrap {
width: 500px;
float: left;
height: 100%;
background: rgba(255, 255, 255, 0.75);
-webkit-box-shadow: 4px 3px 14px -5px rgba(0, 0, 0, 0.75);
-moz-box-shadow: 4px 3px 14px -5px rgba(0, 0, 0, 0.75);
box-shadow: 4px 3px 14px -5px rgba(0, 0, 0, 0.75);
}
.bodyLogin {
overflow: hidden;
height: 100%;
}
.bg_image {
height: 1000px;
width: 100%;
}
h1 {
font-family: 'Roboto', sans-serif;
color: #87909c;
font-weight: bolder;
text-align: center;
font-size: 1.5em;
margin-top: 20px;
}
img.logo_image {
width: 500px;
}
img.title_image {
width: 200px;
margin-left: auto;
display: block;
margin-right: auto;
margin-top: -90px;
}
label {
font-size: 12px;
font-weight: bold;
color: #87909c;
float: left;
clear: both;
font-family: 'Roboto', sans-serif;
margin-left: 30px;
margin-top: 15px;
}
input[type="text"],
input[type="password"] {
float: left;
margin-top: 15px;
clear: both;
margin-left: 30px;
font-size: 1.3em;
width: 80%;
outline: none;
border: none;
padding: 10px;
padding-left: 10px;
}
.login_btn,
.register_btn {
float: left;
clear: left;
font-family: 'Roboto', sans-serif;
background: #7289da;
border: solid 1px #7289da;
width: 84%;
margin-left: 30px;
margin-top: 50px;
padding: 20px;
border-radius: 5px;
font-size: 1em;
color: white;
cursor: pointer;
}
.registerLinkWrap,
.loginLinkWrap {
float: left;
clear: left;
margin-left: 30px;
}
a.register_link,
a.login_link {
float: left;
margin-top: 11px;
font-size: 13px;
color: black;
font-family: 'Roboto', sans-serif;
}
a.register_link:hover,
a.login_link:hover {
text-decoration: underline;
}
p.register_sentence,
p.login_sentence {
clear: left;
float: left;
font-size: 12px;
color: #3e4956;
font-family: 'Roboto', sans-serif;
}
.errUsername,
.errPassword,
.errRegister {
float: left;
margin-left: 30px;
margin-top: 3px;
color: red;
font-size: 0.8em;
font-family: 'Roboto', sans-serif;
}
.reg_success {
position: absolute;
background: #f2fae3;
width: 100%;
text-align: center;
padding: 10px;
font-family: 'Roboto', sans-serif;
color: #94b639;
border-bottom: solid 3px #94b639;
}
.reg_neutral {
display: none;
}
/*# sourceMappingURL=styles.css.map*/
<div id="app">
<div data-reactroot="">
<div class="chat-navbar">
Logout
</div>
<div class="chat-wrapper">
<div class="video-section">
<div class="videos">
<canvas class="remoteCanvas" width="320" height="240"></canvas>
<canvas class="localCanvas" width="320" height="240"></canvas>
</div>
</div>
<div class="chat-section">
<ul>No messages</ul>
<textarea placeholder="Type a message" rows="2"></textarea>
</div>
</div>
</div>
</div>
Whenever I load my page, the content area for the product jumps to position (shifts downwards) and so do the social media icons in the footer. You'll see this happen if you refresh the page or simply click on either of the product categories on the left or the navigation links in the fixed footer.
This is happening predominately in Safari. I'm running 8.0.7 on Mac OS X 10.10.4 (Yosemite). Firefox 45.0.2 seems ok. Chrome 50.0.2661.86 acts a little weird with the icons flashing and copyright text, so I believe that has the same issue though the load time may be quicker.
I've looked at my CSS, but I can't fathom why it's doing it(?). I'm really stuck and realise it's perhaps something simple I'm overlooking. Driving me loopy! :-(
A friend told me it has something to do with the floats for the catalogue_wrapper_right, it shouldn't be there. That's for the content. And, I'm not sure again for the footer. Help much appreciated to get this fixed.
The product content text is being populated using PHP from my database.
The key elements here to look at are catalogue_wrapper and catalogue_wrapper_right for the content, and then container and social for the footer div blocks.
Thanks.
CSS:
/* ===============================
Author: Ashley Smith
Date: July 11, 2015
Notes:
Colour Palette:
---------------
Light Cream: #f2f3ee
Orange: #d17f38
Yellow: #e8c04f
Brown: #4b2707
=============================== */
/* General */
body {
background: url('../images/wood 4.jpg') top left no-repeat; top no-repeat; background-attachment: fixed;
background-size: 100% 100%;
color: black;
-webkit-font-smoothing: antialiased;
text-rendering: optimizelegibility;
font-size: 14px;
font-family: 'Open Sans', "Helvetica Neue", Arial, sans-serif;
}
.container {
width: 1280px;
margin: 0 auto;
padding: 30px 24px;
background: white;
-webkit-box-shadow: 0px 0px 19px 0px rgba(0,0,0,1);
-moz-box-shadow: 0px 0px 19px 0px rgba(0,0,0,1);
box-shadow: 0px 0px 19px 0px rgba(0,0,0,1);
border-top-left-radius: 10px;
border-top-right-radius: 10px;
border-bottom-left-radius: 10px;
border-bottom-right-radius: 10px;
clear: both;
}
/* Typography */
p {
margin: 0;
padding: 0;
}
a {
text-transform: uppercase;
text-decoration: none;
list-style: none;
padding: 0px 10px;
font-weight: bold;
color: black;
margin: 0;
}
/* Header */
header.main{
background: white;
padding: 10px;
margin-top: -30px;
margin-bottom: -30px;
height: 141px;
}
header nav {
text-align: center;
}
header nav ul {
margin: 0;
padding: 0;
list-style: none;
display: inline-block;
line-height: 141px;
}
header nav ul li {
display: inline-block;
padding: 0 20px;
}
header nav ul li a {
text-transform: uppercase;
text-decoration: none;
font-weight: bold;
}
header nav ul li#logo a {
display: block;
width: 200px;
height: 150px;
padding: 0;
background: url('../images/LogoM.svg') center center no-repeat;
background-size: 300px;
}
header nav ul li#logo a p {
opacity: 0;
}
/* Small Basket */
#small_basket {
width: 200px;
margin-bottom: 20px;
}
#basket_left dt {
clear: left;
width: 170px;
}
#basket_left {
margin-top: 30px;
margin-bottom: 0;
}
#basket_left dd {
text-align: right;
width: 150px;
margin-bottom: 15px;
}
#basket_left, #basket_left dd, #basket_left dt {
float: left;
}
#basket_left dd.bl_ti, #basket_left dd.bl_st, #basket_left dd.bl_vat, #basket_left dd.bl_total {
display: block;
width: 0px;
padding: 0;
clear: all;
margin-left: 0px;
}
.your_bas {
width: 200px;
border-bottom: dashed 1px #aaa;
padding-bottom: 9px;
}
.check_button {
border-bottom: dashed 1px #aaa;
}
.check_button, .check_button a {
clear: left;
padding: 0px 0px 14px 0px;
font-style: normal;
font-size: 14px;
font-family: 'Open Sans', 'Helvetica Neue', Arial, sans-serif;
font-weight: normal;
text-transform: none;
}
.red {
color: red;
}
span.cart_pic {
background: url('../images/cart.png') center center no-repeat;
display: inline-block;
position: relative;
top: 10px;
left: 15px;
width: 30px;
height: 30px;
}
/* Store Content Styling */
#wrapper {
width: 1280px;
text-align:left;
margin:0 auto;
padding: 14px 0;
}
#outer {
width: 1280px;
margin: 0 auto;
padding: 30px 24px;
background: white;
-webkit-box-shadow: 0px 0px 19px 0px rgba(0,0,0,1);
-moz-box-shadow: 0px 0px 19px 0px rgba(0,0,0,1);
box-shadow: 0px 0px 19px 0px rgba(0,0,0,1);
border-top-left-radius: 10px;
border-top-right-radius: 10px;
border-bottom-left-radius: 10px;
border-bottom-right-radius: 10px;
}
#cat_left {
width: 150px;
}
#cat_left p {
font-size: 20px;
margin: -5px;
font-weight: 300;
text-indent: 5px;
}
#cat_right {
margin-left: 147px;
width: 900px
}
#cat_navigation {
margin-top: 20px;
margin-bottom: 14px;
width: 200px;
line-height: 35px;
list-style: none;
border-top: dashed 1px #aaa;
padding: 0;
float: left;
}
#cat_navigation li {
float: left;
background-color: rgba(209,209,209,0.4);
text-align: center;
width: 100%;
padding: 2px;
margin-bottom: 10px;
}
#cat_navigation li a {
width: 150px;
opacity: 0.2;
font-size: 14px;
font-weight: 300;
padding: 0;
}
#cat_navigation li a.act {
opacity: 1;
font-weight: 700;
}
#cat_prod {
border-bottom: dashed 1px #aaa;
margin-bottom: 0;
padding-bottom: 14px;
}
#cat_prod h1 {
font-size: 20px;
margin: -5px;
margin-bottom: 1px;
font-weight: 300;
}
/* Catalogue Styling For Products Alignment... Continued */
.catalogue_wrapper {
width:100%;
border-bottom: dashed 1px #aaa;
height: 100%;
display: block;
clear: both;
position: static;
}
.catalogue_wrapper_left {
display: inline-block;
width: 120px;
margin-top: 20px;
}
.catalogue_wrapper_right {
display: block;
width: 750px;
position: relative;
left: 150px;
height: 180px;
margin-top: -120px;
margin-bottom: -40px;
}
.catalogue_wrapper_right h4 a {
padding: 0;
font-size: 20px;
}
.catalogue_wrapper_left a img {
width: 120px;
height: 150px;
}
.catalogue_wrapper_left a {
padding: 0;
}
/* Catalaogue Floats */
#cat_left, #cat_right, #catalogue_wrapper, #catalogue_wrapper_left, #catalogue_wrapper_right {
float: left;
}
/* Catalogue Products Pages */
.catalogue_wrapper_product_right {
font-size: 20px;
font-weight: bold;
text-transform: uppercase;
display: block;
width: 750px;
position: relative;
left: 150px;
height: 180px;
margin-top: -70px;
margin-bottom: -40px;
}
.product_info {
font-size: 14px;
display: block;
width: 750px;
text-transform: none;
top: -63px;
}
/* Buttons */
input::-moz-focus-inner {
border: 0;
padding: 0;
}
/* Basket and Checkout Buttons */
.sbm, .btn {
vertical-align: middle;
cursor: pointer;
display:block;
text-transform: uppercase;
font-weight: bold;
font-size: 14px;
}
.sbm_blue {
background: transparent;
background-color: #43a9d9;
border-radius: 4px;
border: none;
padding: 10px 15px;
}
.btn {
text-transform: uppercase;
background: transparent;
background-color: #43a9d9;
border: none;
border-radius: 4px;
color: white;
}
#btn_login {
text-transform: uppercase;
border-radius: 4px;
background: transparent;
background-color: #43a9d9;
border: none;
color: white;
padding: 0px 15px;
}
#btn {
text-transform: uppercase;
background-color: #43a9d9;
border-radius: 4px;
color: white;
padding: 0px 15px;
}
.fl_l {
float: left;
}
.fl_r {
float: right;
}
/* Basket Button */
.add_to_basket {
padding: 6px 12px;
text-transform: uppercase;
background-color: #43a9d9;
border-radius: 4px;
color: white;
}
/* Basket Page */
.ta_r, th.ta_r, .td.ta_r {
text-align: right;
padding: 10px;
}
.ta_left {
text-align: left;
padding: 10px;
}
.ta_right {
text-align: right;
padding: 10px 0px;
}
.col_15 {
width: 15%
}
.tbl_repeat {
width: 900px;
margin-top: 25px;
}
.ta_left_name {
text-align: left;
padding: 10px;
width: 650px;
}
.ta_left_qty input {
width: 40px;
}
.ta_r a {
padding: 0;
text-transform: none;
}
.fld_qty {
border: solid 1px #aaa
}
.fld_qty {
width: 30px;
text-align: right;
padding: 0
}
/* Checkout Page */
.tbl_insert {
margin-bottom:14px;
width: 900px;
line-height: 34.5px;
}
.tbl_insert td {
padding:3px;
}
.tbl_insert th {
padding: 3px 10px 3px 0;
width: 170px;
font-weight: normal;
vertical-align: top;
}
.fld {
width: 700px;
}
.warn {
display: block;
color: #900;
padding: 0;
vertical-align: text-bottom;
}
/* Orders Table */
.order_table {
width: 900px;
}
th.fix_width {
width: 900px;
}
hr#prod_break {
/* Gradient transparent - color - transparent */
border: 0;
height: 1px;
width: 600px;
background-image: linear-gradient(to right, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0));
}
.tbl_repeat
{
position:relative;
-webkit-box-shadow:0 1px 10px rgba(0, 0, 0, 0.5), 0 0 40px rgba(0, 0, 0, 0.1) inset;
-moz-box-shadow:0 1px 10px rgba(0, 0, 0, 0.5), 0 0 40px rgba(0, 0, 0, 0.1) inset;
box-shadow:0 1px 10px rgba(0, 0, 0, 0.5), 0 0 40px rgba(0, 0, 0, 0.1) inset;
}
.tbl_repeat:before, .tbl_repeat:after
{
position:absolute;
z-index:-1;
-webkit-box-shadow:0 0 20px rgba(0,0,0,0.8);
-moz-box-shadow:0 0 20px rgba(0,0,0,0.8);
box-shadow:0 0 20px rgba(0,0,0,0.8);
top:50%;
bottom:0;
left:10px;
right:10px;
-moz-border-radius:400px / 100px;
border-radius:400px / 100px;
}
/* Product Paging */
.paging {
list-style: none;
width: 900px;
float: left;
/* background: #efefef; */
padding: 10px 10px;
color: white;
}
.paging li {
float: left;
margin-right: 10px;
font-size: 14px;
}
.paging a {
text-transform: none;
text-decoration: underline;
color: black;
padding: 0;
font-weight: normal;
color: white;
}
/* Pagination Navigation Buttons
http://www.flaticon.com/packs/metrize - - no class colour: #D9D9D9
*/
a.first {
position: relative;
display: block;
width: 32px;
height: 32px;
background: url('../images/first.svg') top center no-repeat;
background-size: 32px;
}
a.firstno {
position: relative;
display: block;
width: 32px;
height: 32px;
background: url('../images/firstno.svg') top center no-repeat;
background-size: 32px;
}
a.previous {
position: relative;
display: block;
width: 32px;
height: 32px;
background: url('../images/previous.svg') top center no-repeat;
background-size: 32px;
}
a.previousno {
position: relative;
display: block;
width: 32px;
height: 32px;
background: url('../images/previousno.svg') top center no-repeat;
background-size: 32px;
}
a.next {
position: relative;
display: block;
width: 32px;
height: 32px;
background: url('../images/next.svg') top center no-repeat;
background-size: 32px;
}
a.nextno {
position: relative;
display: block;
width: 32px;
height: 32px;
background: url('../images/nextno.svg') top center no-repeat;
background-size: 32px;
}
a.last {
position: relative;
display: block;
width: 32px;
height: 32px;
background: url('../images/last.svg') top center no-repeat;
background-size: 32px;
}
a.lastno {
position: relative;
display: block;
width: 32px;
height: 32px;
background: url('../images/lastno.svg') top center no-repeat;
background-size: 32px;
}
a#top_of_page {
display: block;
position: relative;
text-transform: uppercase;
text-decoration: none;
font-weight: bold;
background-color: #43a9d9;
top: -31px;
left: 45px;
color: white;
border-radius: 4px;
padding: 7px;
}
/* Proceed to Paypal */
#frm_pp {
display: none
}
.dn {
display: none;
}
/* Google reCAPTCHA */
.g-recaptcha {
display: inline-block;
position: relative;
width: 304px;
height: 78px;
}
/* Footer */
footer.main, #footer {
bottom: 0px;
width: 100%;
height: 182px;
position: fixed;
text-align: center;
margin-bottom: -20px;
}
footer.main div.footbord {
border-top-left-radius: -10px;
border-top-right-radius: -10px;
background-color: blue;
}
#uncopyright, #credits {
width: 100%;
margin: 5px 5px;
text-align: center;
display: inline-block;
position: static;
clear: both;
}
#uncopyright {
display: inline-block;
position: static;
margin-top: -20px;
clear: both;
}
div.social img {
width: 40px;
position: relative;
margin: 5px;
display: inline-block;
}
.social {
position: static;
height: 56px;
display: inline-block;
}
.social, .social a {
text-transform: uppercase;
text-decoration: none;
list-style: none;
padding: 0px 10px;
font-weight: bold;
color: black;
margin: 0;
}
/* -- Center Placeholder For Form Text and Keep Entry Field Left -- */
::-webkit-input {
text-align: left;
}
::-webkit-input-placeholder {
text-align: center;
}
::-moz-placeholder {
text-align: center;
}
/* -- Blank Spacing At Bottom Of Main Container -- */
div.nav_top {
height: 30px;
width: 100px;
}
div.nav_top_after {
height: 30px;
width: 100px;
}
div.cont_bot {
height: 230px;
width: 100px;
}
div.cat_space {
height: 20px;
}
/* Force Elements To Self Clear Its Children: http://css-tricks.com/snippets/css/clear-fix/ */
.clearfix:after {
visibility: hidden;
display: block;
content: "";
clear: both;
height: 0;
}
* html .group { zoom: 1; } /* IE6 */
*:first-child+html .group { zoom: 1; } /* IE7 */
I fixed it by messing around all evening with floats in CSSEdit. A great application!