How do I make VSCode read my Navigation code? - html

I am currently working on my navigation bar on VScode. I want it to be on the right top corner(where I am going to place my logo) and aligned side by side. but my code does not seem to be working.
here is my codepen link:
https://codepen.io/Zeynepbozdayi/pen/eYgOmPo
#import url('https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css');
#import url('https://fonts.googleapis.com/css2?family=Lexend+Mega&display=swap');
#header {
position: fixed;
background-color: white;
width: 100%;
height: 80px;
top: 0px;
left: 0px;
/*z-index: 2;*/
}
.nav {
float: right;
font-family: 'Lexend Mega', sans-serif;
text-transform: uppercase;
}
.nav ul {
padding: 0;
margin: 0;
}
.nav ul li {
float: left;
list-style-type: none;
border: 1px solid #eee;
}
.nav ul li a {
background-color: black;
color: white;
padding: 10px;
display: block;
text-decoration: none;
}
.nav ul li a:hover {
background-color: white;
color: black;
}
#branding {
width: 200px;
height: 50px;
float: left;
background: url('http://lorempixel.com/output/business-q-g-301-63-4.jpg') no-repeat center center;
background-size: 200px;
}
#minimenu {
display: none;
}
.section:nth-child(even) {
background-color: #dddddd;
}
.section {
min-height: 1000px;
padding-top: 100px;
overflow: hidden;
/*position: relative;*/
font-family: 'Lexend Mega', sans-serif;
color: red;
section article {
padding: 15px;
background-color: rgba(255, 255, 255, 0.8);
}
#about {
background: url('http://lorempixel.com/output/city-q-c-1460-1010-5.jpg') no-repeat;
background-size: cover;
}
#products {
background: url('http://lorempixel.com/output/business-q-c-1460-1010-8.jpg') no-repeat;
background-size: cover;
}
<header id="header">
<div id="menu">
<div id="branding"><img src="http://lorempixel.com/output/business-q-g-301-63-4.jpg"></div>
<div id="minimenu"><i class="fa fa-bars"></i></div>
<nav id="nav">
<ul>
<li>Home</li>
<li>About</li>
<li>Redesign</li>
<li>From You</li>
</ul>
</nav>
</div>
</header>
<div id="container">
<!-- This is the Home section -->
<section id="home" class="section">
<header>
<h1>CREATIVE</h1>
<h1>CLOTHING</h1>
<h1>DESIGN</h1>
<h1>with Zebo’s</h1>
</header>
<article>
<p>Reuse, reduce, recycle- it generates less overall waste,
it’s free, and your favorite pieces of clothes will last longer. In a few easy steps
you can redesign your own clothes in fashionable ways.
<strong><p>Here is how:</p> </strong>
</article>
</section>
<!-- This is the About section -->
<section id="about" class="section">
<header>
<h2>ABOUT</h2></header>
<article>
<p>
It is very important to recycle our unused or overused clothes. Because textile and fashion industries
are not as innocent as they seem to be. The fashion indusrty is the second biggest polluter
in the world after the oil industry. Process of cloth making includes high rates of water pollution,
water consumption, microfibers in the ocean, waste accumulations, greenhouse gas emission and many
more impacts to the world.</p>
<p>
Our mission is to show people how to bring their old clothes or shoes back to life in a fashionable
way and embrace them to be considered when buying or giving away their clothes.
</p>
</article>
</section>
<!-- This is the Product section -->
<section id="Redesign" class="section">
<header>
<h2>LET’S REDESIGN A PAIR OF SHOES</h2></header>
<article>
<p>This section will show you a tutorial for how to redesign your high top Converse shoes.</p>
<p>Lets start:</p>
<h3>STEP#1: FIND A HIGH TOP CONVERSE TO REPAIR</h3>
</article>
</section>
<!-- This is the Contact section -->
<section id="From You" class="section">
<header>
<h2>From You</h2>
</header>
</section>
</div>

Your CSS has .nav (which selects <anything class="nav"> but your HTML has <nav id="nav">.
You need to change your CSS to use #nav.
or nav (if you will only ever have a single <nav> element on your page.
or nav#nav (if you want to be redundant).
My solution is posted below. I've also made the following changes:
Making your selectors more consistent (indentation, using the child-selector > instead of the descendant selector where appropriate).
Use a single <h1>, with <br /> for line-breaks instead of separate <h1> elements.
Removing all float: rules and instead use display: flex; for only nav > ul.
Use position: sticky instead of position: absolute for #header.
#import url('https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css');
#import url('https://fonts.googleapis.com/css2?family=Lexend+Mega&display=swap');
#header {
position: -webkit-sticky;
position: sticky;
background-color: white;
box-sizing: border-box;
height: 80px;
top: 0;
right: 0;
z-index: 2;
}
#nav {
font-family: 'Lexend Mega', sans-serif;
text-transform: uppercase;
}
#nav ul {
padding: 0;
margin: 0;
display: flex;
}
#nav ul > li {
list-style-type: none;
border: 1px solid #eee;
}
#nav ul > li > a {
background-color: black;
color: white;
padding: 10px;
display: block;
text-decoration: none;
}
#nav ul li a:hover {
background-color: white;
color: black;
}
#branding {
width: 200px;
height: 50px;
float: left;
background: url('http://lorempixel.com/output/business-q-g-301-63-4.jpg') no-repeat center center;
background-size: 200px;
}
#minimenu {
display: none;
}
.section:nth-child(even) {
background-color: #dddddd;
}
.section {
min-height: 1000px;
padding-top: 100px;
overflow: hidden;
font-family: 'Lexend Mega', sans-serif;
color: red;
.section article {
padding: 15px;
background-color: rgba(255, 255, 255, 0.8);
}
#about {
background: url('http://lorempixel.com/output/city-q-c-1460-1010-5.jpg') no-repeat;
background-size: cover;
}
#products {
background: url('http://lorempixel.com/output/business-q-c-1460-1010-8.jpg') no-repeat;
background-size: cover;
}
<header id="header">
<div id="menu">
<div id="branding"><img src="http://lorempixel.com/output/business-q-g-301-63-4.jpg"></div>
<div id="minimenu"><i class="fa fa-bars"></i></div>
<nav id="nav">
<ul>
<li>Home</li>
<li>About</li>
<li>Redesign</li>
<li>From You</li>
</ul>
</nav>
</div>
</header>
<div id="container">
<!-- This is the Home section -->
<section id="home" class="section">
<header>
<h1>
CREATIVE<br />
CLOTHING<br />
DESIGN<br />
with Zebo’s
</h1>
</header>
<article>
<p>Reuse, reduce, recycle- it generates less overall waste,
it’s free, and your favorite pieces of clothes will last longer. In a few easy steps
you can redesign your own clothes in fashionable ways.
<strong><p>Here is how:</p> </strong>
</article>
</section>
<!-- This is the About section -->
<section id="about" class="section">
<header>
<h2>ABOUT</h2>
</header>
<article>
<p>
It is very important to recycle our unused or overused clothes. Because textile and fashion industries
are not as innocent as they seem to be. The fashion indusrty is the second biggest polluter
in the world after the oil industry. Process of cloth making includes high rates of water pollution,
water consumption, microfibers in the ocean, waste accumulations, greenhouse gas emission and many
more impacts to the world.</p>
<p>
Our mission is to show people how to bring their old clothes or shoes back to life in a fashionable
way and embrace them to be considered when buying or giving away their clothes.
</p>
</article>
</section>
<!-- This is the Product section -->
<section id="Redesign" class="section">
<header>
<h2>LET’S REDESIGN A PAIR OF SHOES</h2></header>
<article>
<p>This section will show you a tutorial for how to redesign your high top Converse shoes.</p>
<p>Lets start:</p>
<h3>STEP#1: FIND A HIGH TOP CONVERSE TO REPAIR</h3>
</article>
</section>
<!-- This is the Contact section -->
<section id="From You" class="section">
<header>
<h2>From You</h2>
</header>
</section>
</div>

Related

Cant get nav bar to hide content when I scroll up

I am building a landing page and am wondering why I cant get my navbar to work properly. I formatted it right, but one issue I am running into is when I scroll down the text goes through the nav bar/header when it should be going behind it or not visible when you scroll down. Anybody know a way that I can fix this issue? Here's the code that I have:
HTML:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Vanderlay Industries</title>
</head>
<body>
<header id="header">
<img id="header-img" src=http://nextarts.info/wp-content/uploads/art-vandelay-06-quotplaying-with-powerquot-art-vandelay.jpg alt="Vanderlay President">
<div>
<h1>Vandelay Industries, Inc.</h1>
<p id="subtitle">Importer/Exporter of Fine Latex Goods</p>
</div>
<div>
<nav id="nav-bar">
<ul>
<li><a class="nav-link" href="#features">Features</a></li>
<li><a class="nav-link" href="#demonstration">Demonstration</a></li>
<li><a class="nav-link" href="#pricing">Pricing</a></li>
</ul>
</nav>
</div>
</header>
<div id="features">
<h2 class="title">Features</h2>
<div id="fine">
<h3 class="title">Fine</h3>
<img id="fine-image" src="https://f4.bcbits.com/img/0007459691_10.jpg" alt="Fancy Fine Lettering">
<p class="description">What we sell is always of the finest quality. Founded on February 12, 1992; no higher standard of fine has been met. Whether it be the local fire department or public water supply, we've set the bar for the finest. With Vandelay, you'll always be
enjoying the finer things</p>
</div>
<div id="Latex">
<h3 class="title">Latex</h3>
<div>
<img id="latex-image" src="http://mjtrends.b-cdn.net/images/product/963/pearlsheen-metallic-blue-latex-sheeting_370x280.jpg" alt="Latex Image">
</div>
<p class= "description">Our latex is so strong you couldn't even fabricate it. Or make a ficticious firm about it. That's how authentic our latex is. Try it today.</p>
</div>
<div id="Goods">
<h3 class="title">Goods</h3>
<img id="goods-image" src="http://wefirstbranding.com/wp-content/uploads/2010/09/virtual-goods1.jpg" alt="Pile of Goods">
<p>If you got the goods, you got the goods. And we got em. Lots of em. Whether it be potato chips or diapers, the goods at our firm are plentiful.</p>
</div>
</div>
<br><br><br>
<div id="demonstration">
<h2>Latex Demonstration</h2>
<iframe id="video" width="420" height="315" src="https://www.youtube.com/embed/p8qnYz5jHag"></iframe>
<p>Take the pleasure of viewing a sublime presentation of latex</p>
</div>
<div id="pricing">
<div class="productLabel">
<h4>Latex 1</h4>
</div>
<div class="price">
<h3>$1,000</h3>
Our base model. Very popular option.
</div>
<div class="productLabel">
<h4>Latex 2</h4>
</div>
<div class="price">
<h3>$5,000</h3>
A more luxury material from the far land of Bosco.
</div>
<div class="productLabel">
<h4>Latex 3</h4>
</div>
<div class="price">
<h3>$10,000</h3>
The finest we offer, genetically superior good through marine biology.
</div>
</div>
<section>
<p>For more information, please enter your email below. We will be happy to send you a free latex demonstration!</p>
<form id="form" action="https://www.freecodecamp.com/email-submit">
<label for=email>Enter your email address:</label>
<input id="email" type=email name="email" required>
<input id="submit" type="submit" value="Submit">
</form>
</section>
<footer>
© Vandelay Industries Inc.
</footer>
CSS:
body {
background: rgba(0, 0, 128, 90%);
color: #f7ed36;
}
#nav-bar {
color: #f7ed36;
display: flex;
position: relative;
flex-direction: row;
}
ul {
width: 35vw;
display: flex;
flex-direction: row;
color: #f7ed36;
position: relative;
left: 250px;
top: 25px;
}
header {
position: fixed;
display: flex;
top: 0px;
width: 100%;
height: 90px;
background: rgba(0, 0, 128, 90%);
}
#subtitle {
font-style: italic;
position: relative;
bottom: 17px;
left: 5px;
}
ul {
list-style: none;
margin: 0;
padding: 0;
overflow: hidden;
}
li a {
display: block;
color: white;
text-align: right;
padding: 10px 20px 10px;
text-decoration: none;
}
.title {
text-align: center;
}
#header-img {
float: left;
width: 80px;
height: 80px;
}
.description {
align: baseline;
text-align: justify;
display: inline;
margin-left: ;
}
#features{
position: relative;
top: 100px;
}
#fine-image {
width: 10%;
height: 10%;
margin: 10px;
}
#latex-image {
width: 10%;
height: 10%;
position: relative;
margin: 10px;
}
#goods-image {
width: 10%;
height: 10%;
margin: 10px;
}
Any thoughts you have is appreciated. I'm sure its pretty common thing to fix since a lot of pages online have it. Thanks!
header {
position: fixed;
display: flex;
top: 0px;
width: 100%;
height: 90px;
background: rgba(0, 0, 128, 90%);
z-index: 2
}
Looks like header would be a sticky header.
If you need header layer to be in front of the page, must use z-index to order the layer.
Give this a Try!
header {
position: fixed;
display: flex;
top: 0px;
width: 100%;
height: 90px;
background: rgba(0, 0, 128, 90%);
background-color: white;
z-index: 999
}
All in that Z-index

Why won't the margin on the top change?

I am trying to edit the margin on the nav bar links, however when I change the margin, nothing happens. Does anyone know why this is happening?
/* Whole Page or not one specific section */
main {
text-align: center;
}
body {
max-width: 100%;
height: 100vh;
margin: 0px 0px 0px 0px;
color: #C2D3CD;
}
.topbar, nav {
background-color: #847E89;
}
/* Top Bar */
#temp-logo, #donate-top {
display: inline-block;
}
#donate-top {
float: right;
padding-right: 2%;
padding-left: 2%;
background-color: #C2D3CD;
color: #847E89;
height: 10vh;
cursor: pointer;
}
.donate-name {
padding-top: 4vh;
background-color: #C2D3CD;
border: none;
cursor: pointer;
}
#temp-logo {
padding-top: 0vh;
margin-left: 2%;
font-size: 22px;
}
.topbar {
display: block;
border-bottom: solid 1px #C2D3CD;
height: 10vh;
}
/* Nav Bar */
nav {
text-align: center;
height: 7vh;
}
.link, link:visited {
color: #C2D3CD;
text-decoration: none;
}
#mission-link, #about-link, #donations-link, #contact-link {
margin-top: 5%;
}
/* First Page */
#home-screen {
background-image: url(Images/beach-background-1-NEW.jpg);
height: 80vh;
width: 100%;
background-repeat: no-repeat;
background-size: 100%;
}
.text {
padding-top: 30vh;
}
/* Gallery */
.img {
width: 20vw;
height: 20vw;
}
.desc {
display: inline-block;
position: relative;
margin: 1%;
}
.desc:hover img {
filter: blur(1.5px) brightness(60%);
transition: 0.3s;
box-shadow: 0 0 10px gray;
}
.desc :not(img) {
position: absolute;
top: 37%;
z-index: 1;
text-align: center;
width: 100%;
color: #FFF;
opacity: 0;
transition: 0.3s;
}
.desc:hover :not(img) {
opacity: 1;
}
.img:hover {
transform: scale(1.1);
}
<!DOCTYPE html>
<html>
<head>
<link href="main.css" rel="stylesheet">
<title>Conejo Teen Organization</title>
</head>
<body>
<!-- Top Bar -->
<div class="topbar">
<!-- Get logo ASAP -->
<p id="temp-logo"><em>Conejo Teen Organization</em></p>
<a id="donate-top" class="donate" href="#"><button class="donate-name">Donate</button></a>
</div>
<!-- Nav -->
<nav>
<a id="mission-link" class="link" href="#">Mission</a>
<a id="about-link" class="link" href="#">About Us</a>
<a id="donations-link" class="link" href="#">What We Do</a>
<a id="contact-link" class="link" href="#">Contact</a>
</nav>
<!-- Main -->
<main>
<!-- First Section -->
<section id="home-screen">
<article class="text">
<h1 id="h1">Conejo Teen Organization</h1>
<p id="h1-desc">Helping California teens in need since 2017</p>
<button id="donate-home" class="donate">Donate Now!</button>
</article>
</section>
<!-- Our Mission -->
<section id="mission">
<h2 id="mission-h2">Our Mission</h2>
<p id="mission-statement">Our goal is to identify organizations and individuals in need, and assist in the most effective and appropriate way. In addition, the specific objective and purpose of Conejo Teen Organization shall be to provitde teens in an opportunity to learn about, perform and be engaged in community service activities. We want to provide a safe outlet and positive culture for teens to engage with other like-minded teens and mentors.</p>
</section>
<!-- Image Gallery (images of projects) -->
<section id="gallery">
<h2 id="images">Gallery</h2>
<!-- Put service images here. On hover, enlarge image and put text overlay with link to that project -->
<div class="row1 row">
<!-- Image 1 -->
<div class="desc-1 desc">
<img src="Gallery/DecMyRoom-1-Edit.jpg" class="img img-1">
<h3 id="img-desc">Dec My Room</h3>
</div>
<!-- Image 2 -->
<div class="desc desc-2">
<img src="Gallery/DecMyRoom-2-Edit.jpg" class="img img-2">
<h3 id="img-desc">Dec My Room</h3>
</div>
<!-- Image 3 -->
<div class="desc desc-1">
<img src="Gallery/DecMyRoom-3-Edit.jpg" class="img img-3">
<h3 id="img-desc">Dec My Room</h3>
</div>
</div>
</section>
</main>
<!-- Footer -->
<footer>
<p id="copyright">&copy 2018 Conejo Teen Organization</p>
<p id="my-credit">Created by Jacob Pieczynski</p>
</footer>
</body>
</html>
You're trying to apply margin-top to inline elements which you can't do since it would disrupt the flow of the page:
#mission-link, #about-link, #donations-link, #contact-link {
display: inline-block; /* Try making them inline block */
margin-top: 5%;
}
Try making the links inline-block.
Add display: inline-block like:
#mission-link, #about-link, #donations-link, #contact-link {
margin-top: 5%;
display: inline-block;
}
I have checked your code remove: height: 10vh; from topbar class

Floats not working, Second Background Image not registering as a background, Centering things?

So to start off let me just note that I am not tech savy at all. I find most computers difficult and I wouldn't be taking this class unless I needed it to graduate from my university.
I'm trying to make a webpage for class thats due tomorrow and I am struggling to get all my stuff positioned properly. I made a mock up design in photoshop for what I'm trying to achieve but actually implementing it has been beyond fustrating.
Most floats aren't working(Probably my fault since I'm struggling to understand the concept).
I also made a secondary background image but its registering as a normal one I think.
Also is there a string of code I can use to center everyting like it is in my mock up?
How its suppose to look
How mine looks
My code:
/*The Main Background*/
body {
background-image: url(../img/background.png);
background-repeat: repeat-x;
}
#HeaderImage{
background-image: url(../img/HeaderImage.png);
background-repeat: no-repeat;
z-index: 1;
background-position: left;
}
.container {
width: 960px;
margin: 0 auto;
font-family: 'Montserrat', sans-serif;
font-size: 100%;
line-height: 1.5;
text-align: center;
}
/* Nav Element */
/*The Search Bar */form div{
/*Margin Header */ 48px;
float:left;
}
.site-navigation {
height: 155px;
}
.site-navigation img {
margin-top: 16px;
float:left;
}
.site-navigation ul {
width: 490px;
margin: 0 auto;
}
.site-navigation li {
margin: 35px 33px;
float: left;
}
.site-navigation a {
color: white;
text-decoration: none;
font-weight: bold;
}
.site-navigation a:hover {
padding-bottom: 2px;
border-bottom: 1px solid white;
}
/* Header Element */
h2 {
line-height: 0.8;
font-size: 72px;
font-weight: bold;
color: #fff;
width: 450px;
border-bottom: 1px solid #d9d9d9;
margin: auto;
margin-top: 115px;
padding-bottom: 42px;
}
.search{
}
.SearchGlass{
float: left;
position: top;
}
<div class="container"></div>
<header class="Team Sky">
<nav class="site-navigation">
<img src="img/TeamSkyLogo.png" alt="Team Sky Logo">
<ul class="clearfix">
<li>shop</li>
<li>checkout</li>
<li>video</li>
</ul>
<!-- SEARCH BAR AND MAGNIFYING GLASS!-->
<div class="SearchGlass" id="SearchGlass">
<img src="img/magnifyingglass.png" alt="Magnifying Glass">
</div>
<form>
<div class="search">
<!-- don't need a label here - use placeholder="" (see forms we did in class - it's on moodle -->
<label for="search">search</label>
<input id="search" type="text" name="search"/>
</div>
</form>
</nav>
<div id="HeaderImage">
<img src="img/HeaderImage.png" alt="Dude on a bike">
</div>
<!-- need to close your form element -->
<div class="TeamSkylogo">
<h2>Team Sky</h2>
</div>
<div class="RoadToYellow">
<P>the road to yellow</P>
</div>
<!--Shop Team Sky-->
<main>
<h1> TEAM NEWS </h1>
<!-- each article/blog should be in it's own container -->
<div class="articleone">
<img src="img/ArticleImageOne.png" alt="Water">
<h1>Giro d'Italia</h1>
<P>Landa will lead the team on the back of his assured and impressive win at the giro del Trentino, and he returns to the race having excelled last year, when he won</P>
<!--readon !-->
</div>
<div class="articletwo">
<img src="img/ArticleImageTwo.png" alt="Bikes by River">
<h1>Krudder Gets a Break</h1>
<P>The powerful German who was a rock in the beginning of the season will now get a break from and is expected to return for the Malecour at the end of the season</P>
<!--readon !-->
</div>
<div>
<img src="img/ArticleImageThree.png" alt="Bike Dudes Biking">
<h1>Kinnick's New Contract</h1>
<P>Peter Kinnick contract is still not settled with the team manager Alistar McDowell saying that a new contract offer has been made</P>
<!--readon !-->
</div>
<div class="articlefour">
<img src="img/ArticleImageFour.png" alt="Single Guy On Bike">
<h1>Froom In Third</h1>
<P>Chris Froom Finished Third in the opening prologue stage at the Criterium du Dauphine with a strong showing on the first day</P>
<!--readon !-->
</div>
</main>
<footer>
<img src="img/sponsor1.png" alt="Team Sky Sponsor">
<img src="img/sponsor2.png" alt="Pinarello">
<img src="img/sponsor3.png" alt="Shimano">
<img src="img/sponsor4.png" alt="Rayha">
<img src="img/sponsor5.png" alt="21ST Century Fox">
</footer>
THANK YOU FOR YOUR HELP
This might help you, but there are lot of issues in the above given code,hope you can get it correct , try this code for now
body {
background-image: url(../img/background.png);
background-repeat: repeat-x;
}
#HeaderImage{
background-image: url(../img/HeaderImage.png);
background-repeat: no-repeat;
z-index: 1;
background-position: left;
}
.container {
width: 960px;
margin: 0 auto;
font-family: 'Montserrat', sans-serif;
font-size: 100%;
line-height: 1.5;
text-align: center;
}
/* Nav Element */
/*The Search Bar */form div{
/*Margin Header */ 48px;
float:left;
}
.site-navigation {
height: 155px;
}
.site-navigation img {
margin-top: 16px;
float:left;
}
.site-navigation ul {
width: 490px;
margin: 0 auto;
}
.site-navigation li {
margin: 35px 33px;
float: left;
}
.site-navigation a {
color: white;
text-decoration: none;
font-weight: bold;
}
.site-navigation a:hover {
padding-bottom: 2px;
border-bottom: 1px solid white;
}
/* Header Element */
h2 {
line-height: 0.8;
font-size: 72px;
font-weight: bold;
color: #fff;
width: 450px;
border-bottom: 1px solid #d9d9d9;
margin: auto;
margin-top: 115px;
padding-bottom: 42px;
}
.search{
}
.SearchGlass{
float: left;
position: top;
}
.article{
float: left;width: 100%;margin-bottom: 15px
}
.article img {float: left;width: 28%;margin-right: 1%}
.article h1{float:left;width: 70%;margin: 5px 0;text-align: left;}
.article p{float:left;width: 70%;margin: 5px 0;text-align: left;}
h1{text-align: left;}
footer{display: block;width: 100%;float: left;}
<div class="container">
<header class="Team Sky">
<nav class="site-navigation">
<img src="img/TeamSkyLogo.png" alt="Team Sky Logo">
<ul class="clearfix">
<li>shop</li>
<li>checkout</li>
<li>video</li>
</ul>
<!-- SEARCH BAR AND MAGNIFYING GLASS!-->
<div class="SearchGlass" id="SearchGlass">
<img src="img/magnifyingglass.png" alt="Magnifying Glass">
</div>
<form>
<div class="search">
<!-- don't need a label here - use placeholder="" (see forms we did in class - it's on moodle -->
<label for="search">search</label>
<input id="search" type="text" name="search"/>
</div>
</form>
</nav>
<div id="HeaderImage">
<img src="img/HeaderImage.png" alt="Dude on a bike">
</div>
<!-- need to close your form element -->
<div class="TeamSkylogo">
<h2>Team Sky</h2>
</div>
<div class="RoadToYellow">
<P>the road to yellow</P>
</div>
<!--Shop Team Sky-->
<div>
<h1> TEAM NEWS </h1>
<!-- each article/blog should be in it's own container -->
<div class="article">
<img src="http://via.placeholder.com/600x500" alt="Water">
<h1>Giro d'Italia</h1>
<P>Landa will lead the team on the back of his assured and impressive win at the giro del Trentino, and he returns to the race having excelled last year, when he won</P>
<!--readon !-->
</div>
<div class="article">
<img src="http://via.placeholder.com/600x500" alt="Water">
<h1>Giro d'Italia</h1>
<P>Landa will lead the team on the back of his assured and impressive win at the giro del Trentino, and he returns to the race having excelled last year, when he won</P>
<!--readon !-->
</div>
</div>
<footer>
<img src="img/sponsor1.png" alt="Team Sky Sponsor">
<img src="img/sponsor2.png" alt="Pinarello">
<img src="img/sponsor3.png" alt="Shimano">
<img src="img/sponsor4.png" alt="Rayha">
<img src="img/sponsor5.png" alt="21ST Century Fox">
</footer>
</div>

Problems Centering Elements and Creating Boxes

I'm building a little play HTML page as I teach myself how to code. I've watched several walkthrough videos and want to incorporate what I've learned without watching the video so that it sticks better. Here is an image of what I'm dealing with.
I want these three sections, 'Learn HTML', 'Learn CSS3', and 'Learn Javascript' to be centered on the page. I created a <section ID=""> tag to center everything on the page under the showcase and 3 separate <div class=""> for each box.
My problem is two-fold, not only are the border boxes not centering on the page, but the boxes aren't even appearing.
Here's the code...
body {
background-color: #FFFAF0;
color: black;
font-family: garamond;
font-weight: normal;
margin: 0;
line-height: 1.6em;
padding: 0;
}
.container {
width: 80%;
margin: auto;
overflow: hidden;
}
#topheader {
background-color: #228B22;
color: white;
margin: auto;
padding: 15px;
text-align: center;
}
#navbar {
background-color: black;
color: white;
}
#navbar ul {
padding: 0;
list-style: none;
}
#navbar li {
display: inline;
margin: auto;
padding-right: 50px;
text-align: center;
}
#navbar a {
color: white;
text-decoration: none;
}
#showcase {
background-image: url('../coding/codage.png');
background-position: center right;
min-height: 300px;
margin-bottom: 30px;
text-align: center;
color: white;
}
#main {
width: 33.3% padding:10px;
margin: auto;
}
.top {
float: left;
border: 3px black;
box-sizing: border-box;
text-align: center;
}
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="ByMyself.css">
<meta charset="utf-8">
<title>How To Build A Website By Yourself</title>
</head>
<body>
<header id="topheader">
<div class="container">
<h1>Learning HTML5 and CSS3</h1>
</div>
</header>
<nav id="navbar">
<div class="container">
<ul>
<li>Home</li>
<li>Learning HTML5</li>
<li>Learning CSS3</li>
<li>About Us</li>
</ul>
</div>
</nav>
<section id="showcase">
<div class="container">
<h1>How to learn how to build a website from scratch! Code The Future!
</h1>
</div>
</section>
<div class="clr"></div>
<section id="main">
<div class="top">
<h2>Learn HTML5</h2>
<ul>
<ol>Step 1 - Watch Tutorials</ol>
<ol>Step 2 - Take Notes</ol>
<ol>Step 3 - Repeat Until It Sinks In</ol>
</ul>
</div>
<div class="top">
<h2>Learn CSS3</h2>
<ul>
<ol>Step 1 - Watch Tutorials</ol>
<ol>Step 2 - Take Notes</ol>
<ol>Step 3 - Repeat Until It Sinks In</ol>
</ul>
</div>
<div class="top">
<h2>Learn Javascript</h2>
<ul>
<ol>Step 1 - Watch Tutorials</ol>
<ol>Step 2 - Take Notes</ol>
<ol>Step 3 - Repeat Until It Sinks In</ol>
</ul>
</div>
</section>
</body>
</html>
There are a few problems:
FLOAT: What you need to do is apply both a width (of about a third) and a margin to your three .top elements. Note that the width should take the margins into consideration, which can be achieved by subtracting them with the calc() function. I've gone with margin: 0 20px; for a horziontal marign of20px and no vertical margin, along with width: calc(33% - 40px);, which takes both the left and right margins into consideration before finding 33% of the available width.
BORDER: You've applied a rule of border: 3px black, which is almost right; you're looking for border: 3px solid black; the solid is critical!
In addition to this, your 'list items' are <ol>, which stands for ordered list. You've essentially got multiple ordered lists inside of an unordered list. These should be list items (<li>) instead, inside of <ol> items, which would look like:
<ol>
<li>Step 1 - Watch Tutorials</li>
<li>Step 2 - Take Notes</li>
<li>Step 3 - Repeat Until It Sinks In</li>
</ol>
However, having said that, you'd benefit from simple <div> tags instead, as each point wants to be on its own line, and you're adding your own "Step 1" prefixes.
This can be seen in the following (click Run Code Snippet then Full Page):
body {
background-color: #FFFAF0;
color: black;
font-family: garamond;
font-weight: normal;
margin: 0;
line-height: 1.6em;
padding: 0;
}
.container {
width: 80%;
margin: auto;
overflow: hidden;
}
#topheader {
background-color: #228B22;
color: white;
margin: auto;
padding: 15px;
text-align: center;
}
#navbar {
background-color: black;
color: white;
}
#navbar ul {
padding: 0;
list-style: none;
}
#navbar li {
display: inline;
margin: auto;
padding-right: 50px;
text-align: center;
}
#navbar a {
color: white;
text-decoration: none;
}
#showcase {
background-image: url('../coding/codage.png');
background-position: center right;
min-height: 300px;
margin-bottom: 30px;
text-align: center;
color: white;
}
#main {
width: 33.3% padding:10px;
margin: auto;
}
.top {
float: left;
border: 3px solid black;
box-sizing: border-box;
text-align: center;
margin: 0 20px;
width: calc(33% - 40px);
}
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="ByMyself.css">
<meta charset="utf-8">
<title>How To Build A Website By Yourself</title>
</head>
<body>
<header id="topheader">
<div class="container">
<h1>Learning HTML5 and CSS3</h1>
</div>
</header>
<nav id="navbar">
<div class="container">
<ul>
<li>Home</li>
<li>Learning HTML5</li>
<li>Learning CSS3</li>
<li>About Us</li>
</ul>
</div>
</nav>
<section id="showcase">
<div class="container">
<h1>How to learn how to build a website from scratch! Code The Future!
</h1>
</div>
</section>
<div class="clr"></div>
<section id="main">
<div class="top">
<h2>Learn HTML5</h2>
<div>Step 1 - Watch Tutorials</div>
<div>Step 2 - Take Notes</div>
<div>Step 3 - Repeat Until It Sinks In</div>
</div>
<div class="top">
<h2>Learn CSS3</h2>
<div>Step 1 - Watch Tutorials</div>
<div>Step 2 - Take Notes</div>
<div>Step 3 - Repeat Until It Sinks In</div>
</div>
<div class="top">
<h2>Learn Javascript</h2>
<div>Step 1 - Watch Tutorials</div>
<div>Step 2 - Take Notes</div>
<div>Step 3 - Repeat Until It Sinks In</div>
</div>
</section>
</body>
</html>
Hope this helps!

Links is not centered in the fixed navigation

I want my navigation links to be centered in my fixed navigation bar i tried to
adding padding but somehow the navigation expands. Also i tried to vertical-align but that didn't do much. I am really new to CSS so explanations would be helpful in cases if this happened again
HTML
`<html>
<html>
<head>
<title>Photography | Home </title>
<link href="app.css" rel="stylesheet"/>
<script type="application/javascript" src="on.js"></script>
</head>
<body>
<header>
<div id="branding">
<h2>PHOTOGRAPHY</h2>
</div>
<nav id="links">
<ul>
<li>Home</li>
<li>About</li>
<li>PHOTO GALLERY</li>
<li>VIDEO GALLERY</li>
</ul>
</nav>
</header>
<section id="showcase">
<div class="container">
<h2>Photography</h2>
<p>Our photo's are always presente in the best
quality possible with carefulness
</p>
</div>
</section>
<section class="boxes">
<div class="container">
<div class="box">asdasdsada
<img src="./images/CameraIcon.png">
<h2>Photography</h2>
<p>Our photographers will always find the perfect photo whether it is a simple click to a full on video</p>
</div>
<div class="box">
<img src="./images/CommunityICON.jpg">
<h2>Guranteed!</h2>
<p>If you are not satisfied with our work you will have an 80% refund</p>
</div>
<div class="box">
<img src="./images/TimeIcon.png">
<h2>Time Managment</h2>
<p>Time management is a crucial step so we are always trying our best to finish up the work quickly, but surely</p>
</div>
</div>
</section>
<footer>
<p>Note that any copyright © is reserved</p>
</footer>
</body>
</html>`
CSS
body {
font-family: Arial, Helvetica, sans-serif;
font-size: 16px;
margin: 0;
padding: 0;
}
p {
margin: 0;
padding: 0;
}
.container {
width: 80%;
margin: auto;
overflow: hidden
}
header {
background-color: #191919;
position: fixed;
width: 100%;
color: #edf9ff;
min-height: 70px;
border-bottom: #0fe216 3px solid;
padding-top: 30px;
}
header a {
text-decoration: none;
text-transform: uppercase;
}
header ul {
margin: 0;
}
header li {
list-style-type: none;
float:right;
text-align: center;
padding-right: 20px;
}
nav {
text-align: center;
}
I would use display: flex. It makes this really easy. Use align-items: center; to center vertically and justify-content: space-between to separate the logo from the nav. Then I would also float your nav li's left, so they're in order. You could use flex there, too, but isn't necessary.
body {
font-family: Arial, Helvetica, sans-serif;
font-size: 16px;
margin: 0;
padding: 0;
}
p {
margin: 0;
padding: 0;
}
.container {
width: 80%;
margin: auto;
overflow: hidden
}
header {
background-color: #191919;
position: fixed;
width: 100%;
color: #edf9ff;
min-height: 70px;
border-bottom: #0fe216 3px solid;
display: flex;
align-items: center;
justify-content: space-between;
}
header a {
text-decoration: none;
text-transform: uppercase;
}
header ul {
margin: 0;
}
header li {
list-style-type: none;
float: left;
text-align: center;
padding-right: 20px;
}
nav {
text-align: center;
}
<html>
<head>
<title>Photography | Home </title>
<link href="app.css" rel="stylesheet" />
<script type="application/javascript" src="on.js"></script>
</head>
<body>
<header>
<div id="branding">
<h2>PHOTOGRAPHY</h2>
</div>
<nav id="links">
<ul>
<li>Home</li>
<li>About</li>
<li>PHOTO GALLERY</li>
<li>VIDEO GALLERY</li>
</ul>
</nav>
</header>
<section id="showcase">
<div class="container">
<h2>Photography</h2>
<p>Our photo's are always presente in the best quality possible with carefulness
</p>
</div>
</section>
<section class="boxes">
<div class="container">
<div class="box">asdasdsada
<img src="./images/CameraIcon.png">
<h2>Photography</h2>
<p>Our photographers will always find the perfect photo whether it is a simple click to a full on video</p>
</div>
<div class="box">
<img src="./images/CommunityICON.jpg">
<h2>Guranteed!</h2>
<p>If you are not satisfied with our work you will have an 80% refund</p>
</div>
<div class="box">
<img src="./images/TimeIcon.png">
<h2>Time Managment</h2>
<p>Time management is a crucial step so we are always trying our best to finish up the work quickly, but surely</p>
</div>
</div>
</section>
<footer>
<p>Note that any copyright © is reserved</p>
</footer>
</body>
</html>