How to set the right space between my sections in css? - html

Well, there are two sections in my HTML code, and those sections have too much space between them, I mean if the screen is fully stretched out and the height is large, it has a dozen of spaces between them. Also for some reason, the second section's text is a bit further from the image.
I've also tried to set display: flex; align-items: flex-start; justify-content:center;, but it hasn't worked. So if you have any idea about this problem, please help.
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'poppins', sans-serif;
}
body {
background: #343131;
}
nav {
height: 80px;
width: 100%;
background-color: #2b2d2e;
background-image: linear-gradient(62deg, #46484a 0%, #2e2e30 100%);
}
nav i {
color: #d35858;
cursor: pointer;
font-size: 40px;
padding-top: 20px;
padding-right: 20px;
float: right;
}
.nav-link {
height: 100vh;
position: fixed;
width: 100%;
background-color: rgb(42, 43, 43);
left: -100%;
top: 10%;
transition: 0.5s;
display: flex;
align-items: flex-start;
justify-content: center;
}
.nav-link a {
text-decoration: none;
color: #fff;
font-size: 30px;
display: block;
text-align: center;
font-weight: bold;
padding: -100px;
}
a:hover,
a.active {
transition: .5s;
color: rgb(239, 122, 122);
}
.nav-link ul li {
padding: 18px;
}
.nav-link ul {
list-style: none;
margin-top: 50px;
}
.nav-bar-top ul {
padding-top: 32px;
float: right;
padding-right: 80px;
}
.nav-bar-top ul li {
display: inline-block;
padding-left: 15px;
}
.nav-bar-top ul li a {
color: #d5c9c9;
text-decoration: none;
}
.nav-bar-top ul li a.active {
color: #fa9e9e;
}
.nav-bar-top ul li a:hover {
color: #d35858;
}
#about-szabi {
width: 100%;
height: 100vh;
background: #343131;
display: flex;
align-items: flex-start;
justify-content: center;
}
#about-szabi .content img {
height: auto;
width: 320px;
max-width: 100%;
}
section .content img:hover {
transform: scale(1.05);
-webkit-transform: scale(1.05);
-moz-transform: scale(1.05);
-o-transform: scale(1.05);
transition: 0.5s;
}
.text {
width: 550px;
max-width: 100%;
padding: 10px 30px;
display: grid;
place-items: center;
text-align: center;
}
.text h1 {
color: #d35858;
font-size: 40px;
display: flex;
align-items: center;
justify-content: center;
text-align: center;
}
.text h5 {
font-size: 20px;
color: rgb(193, 183, 183);
text-align: center;
}
.text p {
color: #e6d6d6;
padding-top: 10px;
font-size: 20px;
}
.content {
width: 1280px;
max-width: 95%;
margin: 0px auto;
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: space-around;
}
#media(min-width: 601px) {
#nav-bar-icon {
display: none;
}
}
#media(max-width: 601px) {
.nav-bar-top ul {
display: none;
}
}
<nav>
<label id="nav-bar-icon">
<i class="fa-solid fa-bars"></i>
</label>
<div class="nav-bar-top">
<ul>
<li>HOME</li>
<li><a class="active" href="info.html">ABOUT US</a></li>
<li>CONTACT</li>
<li>SERVICES</li>
<li>FEEDBACK</li>
</ul>
</div>
</nav>
<div class="nav-link">
<ul>
<li>HOME</li>
<li><a class="active" href="/">ABOUT US</a></li>
<li>CONTACT</li>
<li>SERVICES</li>
<li>FEEDBACK</li>
</ul>
</div>
<section id="about-szabi">
<div class="content">
<img draggable="false" src="../img/person.png">
<div class="text">
<h1>About Szabolcs</h1>
<h5>Programmer & Web Designer</h5>
<p>
IAliquam lobortis posuere felis, sit amet ultrices turpis suscipit in. Mauris
egestas aliquam lacus, non lobortis mi sollicitudin ut. Donec vitae est
malesuada, dapibus nisi ac, placerat felis. Cras tincidunt vehicula lorem eget
efficitur. Integer vestibulum nulla justo. Mauris efficitur viverra est, sit
amet semper orci tristique eget. Nam condimentum accumsan lectus, a efficitur
orci vestibulum a. Nulla quis dui congue leo ultricies convallis id.
</p>
</div>
</div>
</section>
<section id="about-milan">
<div class="content">
<img draggable="false" src="../img/person2.png">
<div class="text">
<h1>About Milán</h1>
<h5>Programmer & Web Designer</h5>
<p>
Donec velit ipsum, accumsan ut lectus eu, sodales hendrerit enim. Fusce ut
sapien sit amet ligula volutpat condimentum vitae in neque. In sit amet erat
et nisi interdum vestibulum. Nunc vestibulum, dolor id pellentesque dictum,
est nulla hendrerit lacus, vitae ultricies mauris ante vitae tellus. Vivamus
ac nisi at justo tempus imperdiet sed faucibus ex. Curabitur ut lectus leo. In
odio magna, aliquet id lectus in, pretium fermentum massa. Fusce eget
condimentum felis. Morbi quis diam massa.
</p>
</div>
</div>
</section>

#about-szabi {
width: 100%;
height: 100%;
background:#343131;
display: flex;
align-items: flex-start;
justify-content: center;
}
In this part, I used 100% instead of 100vh,
And I got the about-milan css in the html field with the same name as the first part.
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'poppins', sans-serif;
}
body {
background:#343131;
}
nav {
height: 80px;
width: 100%;
background-color: #2b2d2e;
background-image: linear-gradient(62deg, #46484a 0%, #2e2e30 100%);
}
nav i {
color: #d35858;
cursor: pointer;
font-size: 40px;
padding-top: 20px;
padding-right: 20px;
float: right;
}
.nav-link {
height: 100vh;
position: fixed;
width: 100%;
background-color: rgb(42, 43, 43);
left: -100%;
top: 10%;
transition: 0.5s;
display: flex;
align-items: flex-start;
justify-content: center;
}
.nav-link a {
text-decoration: none;
color: #fff;
font-size: 30px;
display: block;
text-align: center;
font-weight: bold;
padding: -100px;
}
a:hover, a.active{
transition: .5s;
color: rgb(239, 122, 122);
}
.nav-link ul li {
padding: 18px;
}
.nav-link ul {
list-style: none;
margin-top: 50px;
}
.nav-bar-top ul {
padding-top: 32px;
float: right;
padding-right: 80px;
}
.nav-bar-top ul li {
display: inline-block;
padding-left: 15px;
}
.nav-bar-top ul li a {
color: #d5c9c9;
text-decoration: none;
}
.nav-bar-top ul li a.active {
color: #fa9e9e;
}
.nav-bar-top ul li a:hover {
color: #d35858;
}
/* Not default code */
#about-szabi {
width: 100%;
height: 100%;
background:#343131;
display: flex;
align-items: flex-start;
justify-content: center;
}
#about-szabi .content img {
height: auto;
width: 320px;
max-width: 100%;
}
.section .content img:hover {
transform: scale(1.05);
-webkit-transform: scale(1.05);
-moz-transform: scale(1.05);
-o-transform: scale(1.05);
transition: 0.5s;
}
.text {
width: 550px;
max-width: 100%;
padding: 10px 30px;
display: grid;
place-items: center;
text-align: center;
}
.text h1 {
color: #d35858;
font-size: 40px;
display: flex;
align-items: center;
justify-content: center;
text-align: center;
}
.text h5 {
font-size: 20px;
color:rgb(193, 183, 183);
text-align: center;
}
.text p {
color: #e6d6d6;
padding-top: 10px;
font-size: 20px;
}
.content {
width: 1280px;
max-width: 95%;
margin: 0px auto;
display: flex;
/* sets whether flex items are forced onto one line or can wrap onto multiple lines.
If wrapping is allowed, it sets the direction that lines are stacked */
flex-wrap: wrap;
align-items: center;
justify-content: space-around;
}
#media(min-width: 601px) {
#nav-bar-icon {
display: none;
}
}
#media(max-width: 601px) {
.nav-bar-top ul {
display: none;
}
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>About Us</title>
<link rel="stylesheet" href="../css/info.css">
<script src="https://kit.fontawesome.com/f2665b7baf.js" crossorigin="anonymous"></script>
</head>
<body>
<nav>
<label id="nav-bar-icon">
<i class="fa-solid fa-bars"></i>
</label>
<div class="nav-bar-top">
<ul>
<li>HOME</li>
<li><a class="active" href="info.html">ABOUT US</a></li>
<li>CONTACT</li>
<li>SERVICES</li>
<li>FEEDBACK</li>
</ul>
</div>
</nav>
<div class="nav-link">
<ul>
<li>HOME</li>
<li><a class="active" href="/">ABOUT US</a></li>
<li>CONTACT</li>
<li>SERVICES</li>
<li>FEEDBACK</li>
</ul>
</div>
<section id="about-szabi">
<div class="content">
<img draggable="false" src="../img/person.png">
<div class="text">
<h1>About Szabolcs</h1>
<h5>Programmer & Web Designer</h5>
<p>
IAliquam lobortis posuere felis, sit amet ultrices turpis suscipit in. Mauris
egestas aliquam lacus, non lobortis mi sollicitudin ut. Donec vitae est
malesuada, dapibus nisi ac, placerat felis. Cras tincidunt vehicula lorem eget
efficitur. Integer vestibulum nulla justo. Mauris efficitur viverra est, sit
amet semper orci tristique eget. Nam condimentum accumsan lectus, a efficitur
orci vestibulum a. Nulla quis dui congue leo ultricies convallis id.
</p>
</div>
</div>
</section>
<section id="about-szabi">
<div class="content">
<img draggable="false" src="../img/person2.png">
<div class="text">
<h1>About Milán</h1>
<h5>Programmer & Web Designer</h5>
<p>
Donec velit ipsum, accumsan ut lectus eu, sodales hendrerit enim. Fusce ut
sapien sit amet ligula volutpat condimentum vitae in neque. In sit amet erat
et nisi interdum vestibulum. Nunc vestibulum, dolor id pellentesque dictum,
est nulla hendrerit lacus, vitae ultricies mauris ante vitae tellus. Vivamus
ac nisi at justo tempus imperdiet sed faucibus ex. Curabitur ut lectus leo. In
odio magna, aliquet id lectus in, pretium fermentum massa. Fusce eget
condimentum felis. Morbi quis diam massa.
</p>
</div>
</div>
</section>
<script src="../js/index.js"></script>
Hello, I have a solution for two problems,
You just have to take a look at a .section .content img:hover field for the image to be responsive.

Related

Why does HTML unordered list won't nest and stay the same spot as the main bullet

HTML nested list won't work for me, below is the screenshot of the result but it's aligned to the main bullet. I've seen the tutorials and just did what they did but still the result on my code is not the same as seen on the screenshot. I'm wondering if any of you have encountered this problem. Hoping for some answers. Thank you!
Below is my HTML and CSS code:
* {
margin: 0px;
padding: 0px;
box-sizing: border-box;
}
body {
font-family: 'Poppins', sans-serif;
font-weight: 300;
color: rgb(48, 48, 48);
line-height: 1.9;
background-color: #f3f3f3;
}
.logo {
color: black;
text-transform: uppercase;
letter-spacing: 10px;
padding-right: 150px;
padding-top: 12px;
}
.logo img {
width: 170px;
height: 75px;
padding-top: 8px;
/* padding-right: ; */
/* border: 2px solid black; */
}
nav {
display: flex;
justify-content: space-around;
align-items: center;
min-height: 8vh;
font-family: 'Poppins', sans-serif;
background-color: #f3f3f3;
width: 100%;
z-index: 100;
height: 80px;
/* position: relative; */
/* border-bottom: 1px solid black; */
/* padding: 0 5rem; */
}
.nav-links {
display: flex;
/* justify-content: space-around; */
width: 30%;
}
.nav-links li {
list-style: none;
padding: 26px 40px;
}
.nav-links a {
color: black;
text-decoration: none;
letter-spacing: 2px;
font-size: 15px;
}
nav li:hover {
background-color: rgb(6, 168, 106);
}
nav li:hover a {
color: white;
}
/* Section */
.section {
padding: 5rem 25rem;
border-bottom: 1px solid rgb(187, 185, 185);
/* display: flex; */
}
.section-header {
display: flex;
}
.section1img {
width: 300px;
height: 400px;
/* margin: 60px 150px; */
}
.section1Desc {
padding: 20px 20px;
margin-left: 50px;
text-align: justify;
}
.btnLearnMore {
background-color: rgb(12, 201, 160);
border: none;
border-radius: 5px;
padding: 10px;
margin-top: 30px;
font-size: 20px;
color: white;
}
.bamboo-section {
display: flex;
}
.imgBamboo {
width: 300px;
height: 400px;
}
.bamboo-description {
/* margin-left: 125px; */
margin-top: 50px;
}
.bamboo-description h3 {
color: rgb(16, 143, 16);
}
.btnKalma {
border: none;
border-radius: 5px;
background-color: rgb(25, 179, 145);
color: white;
padding: 5px;
font-size: 17px;
margin-top: 25px;
}
.btnKalma:hover {
background-color: rgb(3, 143, 112);
}
.bamboo-description p {
margin-top: 25px;
text-align: justify;
margin-right: 100px;
}
.lavender-section {
display: flex;
margin-top: 75px;
}
.lavender-description {
margin-left: 100px;
margin-top: 50px;
}
.lavender-description h3 {
color: rgb(202, 0, 158);
}
.lavender-description p {
text-align: justify;
margin-top: 25px;
}
.imgLavender {
width: 300px;
height: 400px;
}
.btnHimbing {
text-decoration: none;
border: none;
border-radius: 5px;
background-color: rgb(165, 50, 180);
color: white;
padding: 5px;
font-size: 17px;
margin-top: 25px;
}
.btnHimbing:hover {
background-color: rgb(122, 4, 138);
}
.benefits-header {
text-align: center;
}
.benefits-body {
display: flex;
justify-content: space-around;
}
.benefits-body div {
/* border: 1px solid black; */
/* height: 60px;
width: 550px; */
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link href="https://fonts.googleapis.com/css?family=Poppins:300,400,500,600&display=swap" rel="stylesheet" />
<link rel="stylesheet" href="./src/fontawesome/css/all.min.css" />
<link rel="stylesheet" href="./css/style.css" />
<title>Deux Citronella Trading</title>
<script defer src="./js/script.js"></script>
</head>
<body>
<header>
<nav>
<div class="logo">
<img src="./rsc/logo2.png" alt="" />
<!-- <img src="./rsc/DeuxLogo.png" alt="Deux Logo" class="imgLogo" /> -->
</div>
<ul class="nav-links">
<li class="nav-link">Home</li>
<li class="nav-link">About</li>
<li class="nav-link">Contact</li>
<li class="nav-link">Products</li>
</ul>
</nav>
</header>
<section class="section" id="section-1">
<div class="section-header">
<img src="./rsc/room&linen.jpg" alt="" class="section1img" />
<div class="section1Desc">
<h3>ROOM & LINEN SPRAY</h3>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent laoreet ipsum lorem, quis vulputate nunc venenatis vitae. Donec rhoncus elit at auctor pellentesque. Suspendisse luctus egestas vestibulum. Suspendisse finibus turpis eget orci fringilla,
in pretium mauris facilisis. Fusce efficitur quam non odio tristique porta. Phasellus bibendum nibh egestas mi bibendum commodo. Donec lobortis ullamcorper eros quis vehicula. Pellentesque et neque a velit bibendum volutpat.
</p>
<button class="btnLearnMore">Learn More</button>
</div>
</div>
</section>
<section class="section" id="section-2">
<div class="bamboo-section">
<div class="bamboo-description">
<h3>Room & Linen Spray: KALMA</h3>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent laoreet ipsum lorem, quis vulputate nunc venenatis vitae. Donec rhoncus elit at auctor pellentesque. Suspendisse luctus egestas vestibulum. Suspendisse finibus turpis eget orci fringilla,
in pretium mauris facilisis. Fusce efficitur quam non odio tristique porta. Phasellus bibendum nibh egestas mi bibendum commodo. Donec lobortis ullamcorper eros quis vehicula. Pellentesque et neque a velit bibendum volutpat.
</p>
<button class="btnKalma">About Kalma &DownArrow;</button>
</div>
<img src="./rsc/bamboo.jpg" alt="Bamboo Spray" class="imgBamboo" />
</div>
<div class="lavender-section">
<img src="./rsc/lavender.jpg" alt="" class="imgLavender" />
<div class="lavender-description">
<h3>Room & Linen Spray: HIMBING</h3>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent laoreet ipsum lorem, quis vulputate nunc venenatis vitae. Donec rhoncus elit at auctor pellentesque. Suspendisse luctus egestas vestibulum. Suspendisse finibus turpis eget orci fringilla,
in pretium mauris facilisis. Fusce efficitur quam non odio tristique porta. Phasellus bibendum nibh egestas mi bibendum commodo. Donec lobortis ullamcorper eros quis vehicula. Pellentesque et neque a velit bibendum volutpat.
</p>
<button class="btnHimbing">About Himbing &DownArrow;</button>
</div>
</div>
</section>
<section class="section" id="section-3">
<div class="benefits-header">
<h2>Benefits</h2>
</div>
<div class="benefits-body">
<div class="first-box">
<ul>
<li>Room freshener</li>
<ul>
<li>Leaving your rooms smelling fresh and relaxing</li>
</ul>
<li>Insect Repellant</li>
<li>Toilet Deodorizer</li>
<li>Sanitizer</li>
</ul>
</div>
<div class="second-box">
<ul>
<li>Car Humidifier</li>
<li>Air Purifier</li>
<li>Disinfectant Spray</li>
<li>Workspace Cleaner</li>
</ul>
</div>
</div>
</section>
</body>
</html>
It's because you do a 'reset' of the margin and padding of all elements with * (universal selector, matches all types) and its declarations.
* {
margin: 0px;
padding: 0px;
box-sizing: border-box;
}
If you remove that, it's showing as you want it to be. Read more about * at MDN. You can also make only adjustments to ul's margin and padding as you wish.
body {
font-family: 'Poppins', sans-serif;
font-weight: 300;
color: rgb(48, 48, 48);
line-height: 1.9;
background-color: #f3f3f3;
}
.benefits-body {
display: flex;
justify-content: space-around;
}
<div class="benefits-body">
<div class="first-box">
<ul>
<li>Room freshener</li>
<ul>
<li>Leaving your rooms smelling fresh and relaxing</li>
</ul>
<li>Insect Repellant</li>
<li>Toilet Deodorizer</li>
<li>Sanitizer</li>
</ul>
</div>
<div class="second-box">
<ul>
<li>Car Humidifier</li>
<li>Air Purifier</li>
<li>Disinfectant Spray</li>
<li>Workspace Cleaner</li>
</ul>
</div>
</div>

Centering aside bar with media query

I have an aside section that I'd like to have centered using a media query, so that once it's viewed on a mobile, it'll be at the bottom of the page aligned horizontally. Just like this:
This is what it's currently doing:
I have some images and text I don't want to share so I'll change them for this question...
body {
font-family: Arial, Helvetica, sans-serif;
font-size: 15px;
line-height: 1.5;
padding: 0;
margin: 0;
background-color: white;
}
/*GLOBAL*/
.container {
width: 80%;
margin: auto;
overflow: hidden;
}
header ul {
padding: 0;
margin: 0;
}
.page-title {
font-size: 20px;
}
.page-title-center {
font-size: 20px;
text-align: center;
}
.subheading-center {
font-size: 15px;
text-align: center;
margin-top: 50px;
}
.dark {
padding: 15px;
background: #1CAC4B;
color: white;
margin-top: 10px;
margin-bottom: 10px;
}
.dark-center {
padding: 15px;
text-align: center;
background: #1CAC4B;
color: white;
margin: 10px;
}
#hyperlink {
color: #FFEE00;
}
#hyperlinkg {
color: #1CAC4B;
}
/*HEADER*/
header {
background: #1CAC4B;
color: #fff;
padding-top: 30px;
min-height: 70px;
border-bottom: #FFEE00 3px solid;
display: flex;
}
header a {
color: #fff;
text-decoration: none;
text-transform: uppercase;
font-size: 15px;
}
header li {
float: left;
display: inline;
padding: 0 10px 0 10px;
}
header #branding {
float: left;
}
header #branding-img img {
float: left;
width: 60px;
height: 60px;
padding: 0 20px 20px 0;
}
header #branding h1 {
margin: 0;
}
header nav {
float: right;
margin-top: 14px;
}
header .highlight, header .current a {
color: #FFEE00 /*YELLOW*/;
}
header a:hover {
color: #cccccc;
font-weight: bold;
}
/*SHOWCASE*/
#showcase {
background:url("../img/grass.jpg") no-repeat;
background-size: cover;
min-height: 450px;
text-align: center;
color: white;
}
#showcase h1 { /**/
margin-top: 150px;
font-size: 60px;
margin-bottom: 10px;
}
#showcase p {
font-size: 30px;
}
/* CONTACT INFO */
#contact {
color: white;
background: #1CAC4B;
padding: 25px;
border-bottom: #FFEE00 3px solid;
border-top: #FFEE00 3px solid;
}
#contact h1 {
float: left;
}
#contact p {
font-size: 20px;
margin-top: 22px;
font-weight: bold;
float: right;
}
/*BOXES*/
.boxes {
background: white; /*Background behind 3 circular images are white */
display: flex; /*Makes circles drop if page is squished */
flex-wrap: wrap; /*Makes circles in a horizontal row */
justify-content: center;
}
.boxes figure {
margin: 3.5%; /*makes it line up better */
text-align: center; /*Puts text in center*/
font-size: 20px;
}
.boxes figure img {
border-radius: 25px; /*Makes images circular */
width: 310px; /*Sets image width*/
height: 220px; /*Sets image height - heigh and width must be same to make it a circular */
box-shadow: gray 0 0 15px; /*Adds gray shadow to bottom of images */
}
/*MAIN-COL*/
article#main-col {
float: left;
width: 70%;
}
/*ABOUT PAGE SIDEBAR*/
aside#about-sidebar {
float: right;
margin-top: 50px;
}
aside#about-sidebar img {
width: 230px;
height: 184px;
/*257px*/
}
/*SERVICES*/
ul#services li {
list-style: none;
padding: 20px;
border: green solid 1px;
margin-bottom: 10px;
background: #e6e6e6;
}
/*SERVICES PAGE SIDEBAR*/
aside#service-sidebar {
float: right;
margin-top: 50px;
}
/*GALLERY SLIDESHOW*/
* {box-sizing: border-box}
.mySlides1, .mySlides2 {display: none}
img {vertical-align: middle;}
/* Slideshow container */
.slideshow-container {
max-width: 800px;
position: relative;
margin: auto;
padding: 10px;
}
/* Next & previous buttons */
.prev, .next {
cursor: pointer;
position: absolute;
top: 50%;
width: auto;
padding: 16px;
margin-top: -22px;
color: white;
font-weight: bold;
font-size: 18px;
transition: 0.6s ease;
border-radius: 0 3px 3px 0;
user-select: none;
}
/* Position the "next button" to the right */
.next {
right: 0;
border-radius: 3px 0 0 3px;
}
/* On hover, add a grey background color */
.prev:hover, .next:hover {
background-color: #f1f1f1;
color: black;
}
/*FOOTER*/
footer {
padding: 20px;
margin-top: 20px;
color: white;
background-color: #1CAC4B;
text-align: center;
}
/*MEDIA QUERIES*/
#media(max-width: 768px){
header #branding,
header nav,
header nav li,
#boxes .box,
article#main-col,
aside#sidebar {
float: none;
align-content: center;
text-align: center;
width: 100%;
}
header {
padding-bottom: 20px;
}
#showcase h1 {
margin-top: 40px;
}
}
<body>
<main>
<header>
<div class="container">
<div id="branding-img">
<a href="index.html"><img src="https://cdn3.iconfinder.com/data/icons/business-avatar-1/512/10_avatar-512.png">
</div>
<div id="branding">
<h1><span class="highlight">NAME SHORT</span>NAME</h1>
</div>
<nav>
<ul>
<li>Home</li>
<li class="current">About</li>
<li>Services</li>
<li>Gallery</li>
</ul>
</nav>
</div>
</header>
<section id="main">
<div class="container">
<article id="main-col">
<h1 class="page-title">About The Company</h1>
<p class="dark">
Curabitur non accumsan tortor. Nulla aliquet risus ac velit consequat pretium. Duis vulputate congue commodo. Proin id mauris velit. Curabitur vel neque congue turpis dictum tristique. Vestibulum sit amet placerat quam. Sed sodales, lacus fermentum condimentum congue, leo mi congue nibh, sit amet aliquam risus sapien ut tellus.Curabitur non accumsan tortor. Nulla aliquet risus ac velit consequat pretium. Duis vulputate congue commodo. Proin id mauris velit. Curabitur vel neque congue turpis dictum tristique. Vestibulum sit amet placerat quam. Sed sodales, lacus fermentum condimentum congue, leo mi congue nibh, sit amet aliquam risus sapien ut tellus.
</p>
<h1 class="page-title">About Me</h1>
<p class="dark">
Curabitur non accumsan tortor. Nulla aliquet risus ac velit consequat pretium. Duis vulputate congue commodo. Proin id mauris velit. Curabitur vel neque congue turpis dictum tristique. Vestibulum sit amet placerat quam. Sed sodales, lacus fermentum condimentum congue, leo mi congue nibh, sit amet aliquam risus sapien ut tellus.
<br>
<br>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec sit amet sapien quis felis imperdiet scelerisque. Maecenas vulputate, nisl quis laoreet efficitur, urna nunc viverra massa, placerat commodo ligula tellus vel lacus. Ut molestie, purus id gravida sollicitudin, ipsum ipsum scelerisque diam, quis hendrerit mauris massa vitae quam. Donec maximus, felis sit amet tincidunt pretium, justo tellus cursus ex, quis vestibulum felis risus sed velit. Vivamus varius sapien sit amet nisl iaculis, et aliquet risus lobortis. In eget ullamcorper augue. If you are interested you can call me using my email or phone number displayed on the <a id="hyperlink" href="index.html">Home</a> page.
</p>
</article>
<aside id="about-sidebar">
<div class="dark">
<img src="https://cdn3.iconfinder.com/data/icons/business-avatar-1/512/10_avatar-512.png">
<p>
PERSON NAME
</p>
</div>
</aside>
</div>
</section>
<footer>
<p>COMPANY</p>
</footer>
</main>
</body>
Of course, as soon as I spent 10 minutes making this question I figured out my problem within literally 10 seconds lol.
I doubt anyone else would have this problem but you never know, so I'll answer it and leave it here for anyone who needs it.
In the CSS file in the media queries section, I removed '#sidebar' from 'aside#sidebar {'

how to move main menu to right corner and squares down to the text?

I'm trying to make Iphone 6/7/8 version for my site.
Unfortuantely I do not know how to move my main menu to right corner so it would look like this in web site:
Right now the site looks like this:
Could you tell me how to move this menu?
What is more, I do not know how to move this 6 squares down to the text. I'm trying to usse marigin-bottom etc on SquaresDOWN div or UP but nothing is happening.
I'd really appreciate if you could help me with these two things.
css
*
{
margin: 0;
padding: 0;
}
header
{
width: 1920;
height: 1080px;
}
body {
display: flex;
flex-direction: column;
min-height: 100vh;
margin:0;
height: 1080px;
width: auto;
background-image: linear-gradient(180deg, #EFEFEF00 0%, #0F4A37 100%);
}
footer{
position: fixed;
left: 0;
bottom: 0;
width: 100%;
background-color: black;
color: white;
text-align: center;
}
footer img{
margin-top: 5px;
height: 30px;
display: inline-block;
padding: 0px 10px 0px 0px;
}
.main-nav
{
float: right;
color: #000000;
margin-top: 40px;
}
.main-nav li
{
display: inline-block;
}
.main-nav li a
{
color: #000000;
text-decoration: none;
font: Bold 25px/15px Arial;
padding: 5px;
}
#logo
{
margin-top: 10px;
float: left;
}
#sign a
{
background-color: #DCDFDE;
padding: 30px 15px 17px 15px;
border-top: 3px solid black;
border-bottom: 3px solid black;
border-left: 3px solid black;
border-right: 3px solid black;
}
.left h1{
font-size: 20px;
color:rgb(0, 1, 253);
text-align: justify;
margin-left: 100px;
}
.left {
float: left;
width: 50%;
margin-right: 500px;
}
#ourteam
{
margin-top: 300px;
margin-left: 100px;
font-size: 60px;
font-weight: bold;
color:rgb(24, 188, 253);
}
#squaresUP div {
display: inline-block;
width: 200px;
height: 200px;
margin-right: 30px;
}
#squaresDOWN div {
display: inline-block;
width: 200px;
height: 200px;
margin-right: 30px;
}
#tytul
{
font: Bold 20px/23px Arial;
letter-spacing: 0;
color: #2699FB;
margin-left: 33px;
margin-top: 60px;
}
#tytul1
{
font: Regular 14px/30px Arial;
letter-spacing: 0;
color: #2699FB;
margin-left: 28px;
margin-top: 100px;
}
.square1 { background: #7FC4FD 0% 0% no-repeat padding-box;}
.square2 { background: #7FC4FD 0% 0% no-repeat padding-box;}
.square3 { background: #7FC4FD 0% 0% no-repeat padding-box;}
.square4 { background: #7FC4FD 0% 0% no-repeat padding-box;}
.square5 { background: #7FC4FD 0% 0% no-repeat padding-box;}
.square6 { background: #7FC4FD 0% 0% no-repeat padding-box;}
#media only screen and (max-device-width: 500px){
body {
background-image: linear-gradient(180deg, #EFEFEF00 0%, #0F4A37 100%);
background-size:100% 3000px;
}
#ourteam
{
margin-top: 300px;
margin-left: 700px;
font-size: 80px;
font-weight: bold;
width: 400px;
color:rgb(24, 188, 253);
}
.left h1{
font-size: 27px;
width: 1500px;
color:rgb(0, 1, 253);
text-align: justify;
margin-left: 100px;
margin-top: 50px;
}
.left {
float: left;
margin-right: 500px;
}
.main-nav
{
float: right;
color: #000000;
margin-top: 40px;
width: 1150px;
}
.main-nav li
{
display: inline-block;
}
.main-nav li a
{
color: #000000;
text-decoration: none;
font: Bold 35px/15px Arial;
padding: 5px;
width: 50px;
}
}
html
<!DOCTYPE html>
<html lang="pl">
<head>
<meta charset="UTF-8">
<title>DingDog</title>
<link rel="stylesheet" href="css-images/style-authors.css" >
</head>
<body>
<header>
<div class="row">
<ul id ="logo"> <img src="css-images/dingdog-logo.png"> </ul>
<ul class="main-nav">
<li style="padding-left:10px">NEWS FEED</li>
<li style="padding-left:10px">ABOUT DINGDOG</li>
<li style="padding-left:10px">AUTHORS</li>
<li style="padding-left:10px">CONTACT</li>
<li style="padding-left:10px" id ="sign">SIGN IN</li>
</ul>
</div>
<section>
<article>
<p id="ourteam">Our Team.</p>
<div class="left">
<h1>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam dictum nisi ac nunc lobortis auctor. Nam nec congue ex, nec ornare elit. Donec feugiat massa vitae mauris euismod malesuada. Pellentesque iaculis dui felis, sit amet molestie augue scelerisque et. Nullam eget mi neque. Ut maximus enim ac fringilla scelerisque. Quisque sit amet sem semper, rutrum nulla eu, fermentum sapien. ILorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam dictum nisi ac nunc lobortis auctor. Nam nec congue ex, nec ornare elit. Donec feugiat massa vitae mauris euismod malesuada. Pellentesque iaculis dui felis, sit amet molestie augue scelerisque et. Nullam eget mi neque. Ut maximus enim ac fringilla scelerisque. Quisque sit amet sem semper, rutrum nulla eu, fermentum sapien. ILorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam dictum nisi ac nunc lobortis auctor. Nam nec congue ex, nec ornare elit. Donec feugiat massa vitae mauris euismod malesuada. Pellentesque iaculis dui felis, sit amet molestie augue scelerisque et. Nullam eget mi neque. Ut maximus enim ac fringilla scelerisque. Quisque sit amet sem semper, rutrum nulla eu, fermentum sapien. I</h1>
</div>
<div class="row2">
<div id="squaresUP">
<div class="square1" style='position:absolute;left:1100px; top:292px;'></div>
<div class="square2"style='position:absolute;left:1350px; top:292px;background: #F1F9FF 0% 0% no-repeat padding-box;'>
<h1 id="tytul" style='position:absolute;left:0px; top:0px;'>Name Surname</h1>
<h1 id="tytul1" style='position:absolute;left:0px; top:0px;'>Co-Founder & CTO</h1>
</div>
<div class="square3"style='position:absolute;left:1600px; top:292px;'></div>
</div>
<div id="squaresDOWN">
<div class="square4"style='position:absolute;left:1100px; top:560px;'></div>
<div class="square5"style='position:absolute;left:1350px; top:560px;'></div>
<div class="square6"style='position:absolute;left:1600px; top:560px;'></div>
</div>
</div>
</article>
</section>
</header>
<footer>
<img src="social/instagram.png" />
<img src="social/twitter-white-logo.png" />
<img src="social/facebook.png" />
</footer>
</body>
</html>
//edit
the squares should be right there. They should be centered under the text.
I have cleaned up your code a little bit and here you can find an example for how to create a header menu inside a css grid looks decent for iphone 7/8 view.
you can change the percentage based on your request to get it a bit bigger if you don't want to create more buttons,
if it doesn't helped you totally at least it could be a reference.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style>
.row{
display: grid;
grid-template-columns: 20% 80%;
}
.main-nav{
float: right;
display: inline-flex;
list-style: none;
font-size: 50%;
}
.main-nav li{
font-size: 50%;
}
</style>
</head>
<body>
<div class="row">
<div id ="logo"><img src="css-images/dingdog-logo.png"></div>
<div>
<ul class="main-nav">
<li style="padding-left:10px">NEWS FEED</li>
<li style="padding-left:10px">ABOUT DINGDOG</li>
<li style="padding-left:10px">AUTHORS</li>
<li style="padding-left:10px">CONTACT</li>
<li style="padding-left:10px" id ="sign">SIGN IN</li>
</ul>
</div>
</div>
<!-- create your html elements and divs below -->
<!-- make sure to arrange them in a decent way to be organzied with y our page -->
<!-- i would suggest you use css grid as i did for the menu and follow almost the same settings
which will make your view look more adjusted and responsive -->
</body>
</html>

Sticky position not working for overlapping scrolling effect

I'm trying to make an overlapping effect when the user scrolls using the sticky position and giving each div (section) a new background colour. However, even after setting top to 0 for the sticky position, the divs scroll out of the viewport. Any help would be great!
$(document).ready(function(){
$('#about').click(function(){
$('#aboutcontainer').slideToggle('slow');
});
});
html, body {
margin: 0 auto;
font-size: 22px;
width: 100%;
height: 100%;
}
h3 {
margin: 0;
}
ul, li {
margin: 0 auto;
}
span {
font-weight: 400;
}
.container {
height:102vh;
}
.contentcontainer {
display: flex;
justify-content: center;
align-items: center;
height: auto;
}
.vertical-center {
margin: 0;
position: absolute;
top: 50%;
-ms-transform: translateY(-50%);
transform: translateY(-50%);
}
#navbar {
width: 100%;
position: sticky;
top: 0px;
background-color: #ffffff;
font-family: Abel;
height: 100px;
}
#desktop-nav-wrapper {
padding: 0 45px;
height: inherit;
position: relative;
}
#logo {
font-size: 200%;
width: auto;
float: left;
letter-spacing: 3px;
}
#desktop-nav-wrapper ul {
margin-top: 6.5vh;
float: right;
}
#desktop-nav-wrapper li {
position: relative;
display: inline-block;
padding-left: 25px;
font-weight: 300;
color: #000000;
font-family: Abel;
}
#desktop-nav-wrapper li:nth-child(even):hover {
cursor: default;
}
#desktop-nav-wrapper li:nth-child(odd):hover {
cursor: pointer;
}
#aboutcontainer {
display: none;
background-color: #ffffff;
}
#aboutcontainer p {
margin-bottom: 0;
padding-left: 45px;
text-align: left;
width: 80%;
font-family: Lato;
font-weight: 300;
font-size: 92%;
}
#one {
background-color: #ffd700;
position: sticky;
top: 0;
}
#two {
background-color: #468499;
position: sticky;
top: 0;
}
#three {
background-color: #468499;
position: sticky;
top: 0;
}
#media only screen and (max-width: 768px) {
#logo {
margin-top: -1vh;
}
#desktop-nav-wrapper {
padding: 0 15px;
height: inherit;
}
#desktop-nav-wrapper ul {
float: left;
padding-left: 0;
width: 100%;
margin-top: 11vh;
}
#desktop-nav-wrapper li {
position: relative;
display: inline-block;
padding-left: 0;
margin-right: 2%;
font-weight: 300;
color: #000000;
font-family: Abel;
}
#aboutcontainer p {
margin-bottom: 0;
padding-left: 15px;
text-align: left;
width: 90%;
font-family: Lato;
font-weight: 300;
font-size: 80%;
}
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div id="navbar">
<div id="desktop-nav-wrapper">
<h3 id="logo" class="vertical-center">Test Header</h3>
<ul>
<li id="about" class="desktop-items">about</li>
</ul>
</div>
</div>
<div id="aboutcontainer" style="display: none;">
<p>
Phasellus vitae semper risus. Quisque in finibus nisi. Sed non rhoncus purus, eu luctus orci. Vestibulum massa nisi, bibendum eget libero ut, tempor mattis metus. Maecenas placerat nisl non mauris fringilla ultricies. Phasellus dignissim velit vitae tellus sodales luctus. Nullam tempus turpis vitae nunc lacinia faucibus. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus eget volutpat nunc. Cras et libero et ligula suscipit finibus et id dui. Duis odio enim, interdum vitae ullamcorper ut, sagittis vitae metus. Phasellus feugiat libero metus, sed tempor erat porttitor ut. Integer vel libero eu ante sollicitudin fermentum non quis nisl. Aliquam blandit dignissim sem, et malesuada risus venenatis eget. Nulla pretium ornare dui fermentum cursus.
</p>
</div>
<div class="container" id="one">
<div class="contentcontainer">
<h3>One</h3>
</div>
</div>
<div class="container" id="two">
<div class="contentcontainer">
<h3>Two</h3>
</div>
</div>
<div class="container" id="three">
<div class="contentcontainer">
<h3>Three</h3>
</div>
</div>
Figured it out... Turns out position: sticky isn't a fan of HTML and body having their height set to 100%. I removed it and it now works fine.

CSS footer will not sit at the bottom of viewport and other misc questions

I'm in the process of teaching myself how to code html/css through various online tutorials and this excellent site.
I've coded this simple css layout just as a test.
A couple of things that I can't seem to workout:
How can I force the footer to stick to the bottom of the viewport when there isn't enough content to fill the screen?
The top Nav bar, what is the best way to make that collapse nicely when the screen size is reduced?
And finally, please feel free to critique my code, any tips, ticks or lessons would the appreciated.
Thanks in advance!
here is the code:
#import url(https://fonts.googleapis.com/css?family=Montserrat:700,400|Open+Sans:400,300,600,700,800);
body {
font-size: 87.5%;
font-family: 'open sans', sans-serif;
line-height: 1.3;
text-align: left;
background-color: lightgrey;
margin: 0;
min-height: 100%;
}
h1 {
font-size: 20px;
font-family: 'open sans', sans-serif;
}
h2 {
margin: 0;
border-bottom: solid black 2px;
}
.wrapper {
margin: 0 auto;
width: 70%;
}
header {
background-color: white;
height: 200px;
display: flex;
align-items: center;
justify-content: space-between;
}
.logo {
width: 30%;
height: 200px;
background-color: rgb(105, 64, 16);
border-radius: 0px 0px 0px 10px;
text-align: center;
display: flex;
align-items: center;
}
.logo h1 {
margin: 0 auto;
font-size: 30px;
color: white;
font-family: Montserrat, sans-serif;
font-weight: 700;
}
nav {
width: 70%;
background-color: rgb(50, 77, 105);
border-radius: 0px 0px 10px 0px;
min-height: 200px;
overflow: hidden;
}
nav ul {
width: 90%;
height: auto;
margin: 50px auto;
padding: 15px;
border-radius: 10px 10px;
background-color: rgb(224, 204, 142);
display: flex;
align-items: center;
justify-content: center;
flex-wrap: wrap;
}
nav ul li {
list-style: none;
display: inline;
padding: 25px;
margin: 0 12px;
border-radius: 10px 10px;
background-color: rgb(121, 207, 219);
font-family: Montserrat, sans-serif;
font-weight: 700;
color: rgb(17, 44, 96);
}
.content-wrapper {
background-color: white;
display: flex;
flex-direction: row;
justify-content: flex-start;
clear: both;
}
.home-content {
width: 66%;
padding: 20px;
}
.home-sidebar {
width: 26%;
padding: 20px;
overflow: hidden;
}
footer {
background-color: rgb(50, 77, 105);
text-align: center;
display: flex;
flex-direction: column;
align-items: center;
}
footer ul {
list-style: none;
margin: 20px 0px 10px 0px;
padding: 0;
}
footer ul li {
display: inline;
padding: 0px 10px;
color: white;
}
footer h1 {
font-size: 30%;
color: white;
padding-bottom: 20px;
padding-top: 10px;
margin: 0;
}
<!DOCTYPE html>
<head>
<link rel="stylesheet" type="text/css" href="styles/styles.css" >
<title>Test</title>
</head>
<body>
<div class="wrapper">
<header>
<div class="logo">
<h1>Logo Goes Here</h1>
</div>
<nav>
<ul>
<li>Page 1</li>
<li>Page 2</li>
<li>Page 3</li>
<li>Page 4</li>
<li>Page 5</li>
</ul>
</nav>
</header>
<div class="content-wrapper">
<div class="home-sidebar">
<h2>Sidebar info</h2>
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa.</p>
<p>Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu.</P>
</div>
<div class="home-content">
<h2>Welcome to company name</h2>
<p>Quisque rutrum. Aenean imperdiet. Etiam ultricies nisi vel augue. Curabitur ullamcorper ultricies nisi. Nam eget dui. Etiam rhoncus. Maecenas tempus, tellus eget condimentum rhoncus, sem quam semper libero, sit amet adipiscing sem neque sed ipsum. Nam quam nunc, blandit vel, luctus pulvinar, hendrerit id, lorem.</p>
<p>Maecenas nec odio et ante tincidunt tempus. Donec vitae sapien ut libero venenatis faucibus. Nullam quis ante. Etiam sit amet orci eget eros faucibus tincidunt. Duis leo.</p>
</div>
</div>
<footer>
<ul id="footNav">
<li>Home</li>
<li>Terms & Conditions</li>
<li>Privacy policy</li>
<li>Copyright</li>
<li>Disclaimer</li></ul>
<h1 id="Copyright">Copyright © 2016 Testing: Something & Something. All Rights Reserved.
</h1>
</footer>
</div>
</body>
<html/>
1- to make your footer sticky you can use
footer{
position:fixed;
bottom:0;
width:100%;
}
2- you could learn how to make your website responsive via twitter-bootstrap
3- your code is good as a beginner but you have to see a lot of websites already made to could produce something like it, you can learn a lot from w3schools
Good luck!
You can use
position : fixed
bottom : 0
width : 100%
css property to fix the footer at the bottom of the screen.
You can have a look at CSS transitions to nicely hide your nav bar. Use CSS Media Queries to get height of device
You have done good work so far, keep improving
For the sticky footer use this code.
html {
height: 100%;
}
body {
min-height: 100%;
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: flex;
-webkit-box-orient: vertical;
-webkit-box-direction: normal;
-webkit-flex-direction: column;
-ms-flex-direction: column;
flex-direction: column;
}
/*container of the main section of the page*/
.content-wrapper {
-webkit-box-flex: 1;
-webkit-flex: 1 0 auto;
-ms-flex: 1 0 auto;
flex: 1 0 auto
}