How to Add Logo image in header next to nav menu - html

I have a navigation menu that's fixed in the left inside a div.
I want to be able to put a logo right next to it, centered, but to the right of the menu.
I'm not able to realise what I have to do in the code in order to get it
I tried using a div inside the div, but that does not do it
* {
background-color: black
}
* {
padding: 0;
margin: 0;
}
.navigation {
z-index: 1;
}
ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: black;
font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif;
font-size: 20px;
font-weight: bold;
border-style: dashed;
border-color: green;
border-radius: 20px;
height: 80px;
width: 750px;
}
li {
float: left;
}
li a {
display: block;
color: white;
text-align: center;
padding: 10px 12px;
text-decoration: none;
border-style: dotted;
margin-left: 24px;
margin-top: 11px;
}
li a:hover {
background-color: red;
}
.parrafo {
font-size: 40px;
padding: 75px;
border-radius: 10px;
margin-top: 10px;
margin-bottom: 10px;
border-left: 22px;
padding-left: 150px;
border-top: dotted 5px red;
border-bottom: dotted 5px yellowgreen;
display: flex;
flex-direction: row;
font-family: sans-serif;
font-weight: bold;
color: white;
}
.queonda {
font-family: sans-serif;
font-weight: bold;
color: white;
font-size: 50px;
margin-left: 85px;
}
.test {
margin-left: 200px;
margin-top: 270px;
}
.test2 {
margin-top: 100px;
margin-bottom: 100px;
margin-left: 750px;
}
.portrait {
overflow: hidden;
display: inline-block;
}
.portrait img {
transition: transform 0.5s linear;
background-image: cover;
}
.portrait:hover img {
transform: scale(1.1);
}
.cat {
height: 1250px;
width: 1900px;
}
.algo {
height: 100vh;
width: 100vw;
}
.active {
overflow: hidden;
background-color: #333;
position: fixed;
top: 0;
width: 100%;
}
.ptm {
font-size: 70px;
color: white;
position: right;
margin-right: 500px;
display: inline;
}
<div class="navigation active">
<ul>
<li>Tour</li>
<li>Listen to Music</li>
<li>Contact</li>
<li>About</li>
</ul>
</div>
<div class="portrait algo"><img src="https://i.ibb.co/dLrSmP7/1111.jpg" alt=""></div>
<div class="parrafo">
<img src="https://muzikercdn.com/uploads/products/4207/420772/09821a89.jpg" alt="Ciudad con Transito">
<P class="test">MUSIC<br>MAINSTREAM SELLOUT</P>
</div>
<div class="test2">
<P class="queonda">VIDEOS</P><br><br>
<video width="1280" controls autoplay="off">
<source src="./img/prueba2.mp4" type="video/mp4">
</div>
<footer class="footer">
<div class="container">
<div class="row">
<div class="footer-col">
<h4>Terms & Conditions</h4>
</div>
<div class="footer-col">
<h4><a class="textDecoration" href="#privacy">Privacy and Policy</a></h4>
</div>
<div class="footer-col">
<h4>Follow Us</h4>
<div class="social-links">
</div>
</div>
<div class="footer-col">
<div class="social-links">
<h3>
</h3>
</div>
</div>
</div>
</footer>
I would really appreciate your help with this

If you want it in the menu but next to it, you should just add the logo as a list item. Then you can give it a class (I called it logo) to reposition it.
See below:
* {
background-color: black
}
* {
padding: 0;
margin: 0;
}
.navigation {
z-index: 1;
}
.logo {
padding: 6px;
border: 0;
margin-left: 4em;
}
ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
background-color: black;
font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif;
font-size: 20px;
font-weight: bold;
border-style: dashed;
border-color: green;
border-radius: 20px;
height: 80px;
width: 750px;
}
li {
float: left;
}
li a {
display: block;
color: white;
text-align: center;
padding: 10px 12px;
text-decoration: none;
border-style: dotted;
margin-left: 24px;
margin-top: 11px;
}
li a:hover {
background-color: red;
}
.parrafo {
font-size: 40px;
padding: 75px;
border-radius: 10px;
margin-top: 10px;
margin-bottom: 10px;
border-left: 22px;
padding-left: 150px;
border-top: dotted 5px red;
border-bottom: dotted 5px yellowgreen;
display: flex;
flex-direction: row;
font-family: sans-serif;
font-weight: bold;
color: white;
}
.queonda {
font-family: sans-serif;
font-weight: bold;
color: white;
font-size: 50px;
margin-left: 85px;
}
.test {
margin-left: 200px;
margin-top: 270px;
}
.test2 {
margin-top: 100px;
margin-bottom: 100px;
margin-left: 750px;
}
.portrait {
overflow: hidden;
display: inline-block;
}
.portrait img {
transition: transform 0.5s linear;
background-image: cover;
}
.portrait:hover img {
transform: scale(1.1);
}
.cat {
height: 1250px;
width: 1900px;
}
.algo {
height: 100vh;
width: 100vw;
}
.active {
overflow: hidden;
background-color: #333;
position: fixed;
top: 0;
width: 100%;
}
.ptm {
font-size: 70px;
color: white;
position: right;
margin-right: 500px;
display: inline;
}
<div class="navigation active">
<ul>
<li>Tour</li>
<li>Listen to Music</li>
<li>Contact</li>
<li>About</li>
<li>
<a class="logo"><img src="https://dummyimage.com/40/#41404/fff"></a>
</li>
</ul>
</div>
<div class="portrait algo"><img src="https://i.ibb.co/dLrSmP7/1111.jpg" alt=""></div>
<div class="parrafo">
<img src="https://muzikercdn.com/uploads/products/4207/420772/09821a89.jpg" alt="Ciudad con Transito">
<P class="test">MUSIC<br>MAINSTREAM SELLOUT</P>
</div>
<div class="test2">
<P class="queonda">VIDEOS</P><br><br>
<video width="1280" controls autoplay="off">
<source src="./img/prueba2.mp4" type="video/mp4"></video>
</div>
<footer class="footer">
<div class="container">
<div class="row">
<div class="footer-col">
<h4>Terms & Conditions</h4>
</div>
<div class="footer-col">
<h4><a class="textDecoration" href="#privacy">Privacy and Policy</a></h4>
</div>
<div class="footer-col">
<h4>Follow Us</h4>
<div class="social-links">
</div>
</div>
<div class="footer-col">
<div class="social-links">
<h3>
</h3>
</div>
</div>
</div>
</div>
</footer>
Side note: forgot to close </video> and the .container div which was making your HTML invalid.

Related

I cannot get a specific div to stop scrolling with the page (I want it to stay in one place)

Despite having position fixed and no transform properties, my "hero" div always moves with the page. I want it to stay put
.hero{
position: fixed;
width: 1500px;
margin-left: 0px;
margin-top: 60px;
}
Full css:
*
{
margin: 0;
padding: 0;
}
header
{
background-image: linear-gradient(rgba(0, 0, 0, 0.5),rgba(0, 0, 0, 0.5)), url(img/snow.jpg);
height: 100vh;
background-size: cover;
background-position: center;
}
.main-nav
{
float: right;
list-style: none;
margin-top: 30px;
}
.main-nav li{
display: inline-block;
}
.main-nav li a{
color:white;
text-decoration: none;
padding: 5px 20px;
font-family: "Roboto", "sans-serif";
}
.main-nav li.active a{
border: 1px solid white;
}
.main-nav li a:hover{
border: 1px solid white;
}
.logo img
{
width: 150px;
height: auto;
float: left;
}
body
{
font-family: monospace;
}
.row
{
max-width: 1200px;
margin: auto;
}
.hero{
position: fixed;
width: 1500px;
margin-left: 0px;
margin-top: 60px;
}
h1{
color: white;
text-transform: uppercase;
font-size: 60px;
text-align: center;
/* margin-top: 275px; */
margin-top: 220;
}
.button
{
margin-top: 30px;
margin-left: 440px;
position: sticky;
}
.btn{
border: 1px solid white;
padding: 10px 30px;
color: white;
text-decoration: none;
margin-right: 5px;
font-size: 13px;
text-transform: uppercase;
position: sticky;
}
.btn-one{
background-color: darkorange;
font-family: "Roboto", sans-serif;
position: sticky;
}
.btn-two{
font-family: "Roboto", sans-serif;
position: sticky;
}
.btn-two:hover{
background-color: darkorange;
transition: all 0.5s ease-in;
}
html,body{
width: 100%;
height: 100%;
margin: 0px;
padding: 0px;
overflow-y: auto;
overflow-x: hidden;
}
#page_2{
height: 1000px;
background-color: red;
}
Full HTML:
<html>
<head>
<title>Summer Website</title>
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<body>
<header>
<div id="page_1">
<div id="particles-js">
<div class="row">
<!-- <div class ="logo">
<img src="https://i.imgur.com/0PyA8HR.png" alt="">
</div> -->
<ul class="main-nav">
<li class ="active"> HOME </li>
<li> ABOUT </li>
<li> PORTFOLIO </li>
</ul>
</div>
<div class="hero">
<h1>HI I'M KACIE AND I LOVE SOLVING PROBLEMS.</h1>
<div class="button">
LINKEDIN
RESUME
</div>
<div class ="bro">
</div>
</div>
</div>
</header>
<!--particles js file -->
<!-- <h1> TEST </h1> -->
<script type="text/javascript" src="js/particles.min.js"></script>
<script type="text/javascript" src="js/app.js"></script>
</div>
<div id=page_2>
</div>
</body>
</html>
There just seems to be problem with your closing tags incorrectly nested. There needs to another closing div before the closing header tag. The snippet shows the hero in a fixed position:
.hero {
position: fixed;
width: 1500px;
margin-left: 0px;
margin-top: 60px;
}
Full css: * {
margin: 0;
padding: 0;
}
header {
background-image: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)), url(img/snow.jpg);
height: 100vh;
background-size: cover;
background-position: center;
}
.main-nav {
float: right;
list-style: none;
margin-top: 30px;
}
.main-nav li {
display: inline-block;
}
.main-nav li a {
color: white;
text-decoration: none;
padding: 5px 20px;
font-family: "Roboto", "sans-serif";
}
.main-nav li.active a {
border: 1px solid white;
}
.main-nav li a:hover {
border: 1px solid white;
}
.logo img {
width: 150px;
height: auto;
float: left;
}
body {
font-family: monospace;
}
.row {
max-width: 1200px;
margin: auto;
}
.hero {
position: fixed;
width: 1500px;
margin-left: 0px;
margin-top: 60px;
}
h1 {
color: white;
text-transform: uppercase;
font-size: 60px;
text-align: center;
/* margin-top: 275px; */
margin-top: 220;
}
.button {
margin-top: 30px;
margin-left: 440px;
position: sticky;
}
.btn {
border: 1px solid white;
padding: 10px 30px;
color: white;
text-decoration: none;
margin-right: 5px;
font-size: 13px;
text-transform: uppercase;
position: sticky;
}
.btn-one {
background-color: darkorange;
font-family: "Roboto", sans-serif;
position: sticky;
}
.btn-two {
font-family: "Roboto", sans-serif;
position: sticky;
}
.btn-two:hover {
background-color: darkorange;
transition: all 0.5s ease-in;
}
html,
body {
width: 100%;
height: 100%;
margin: 0px;
padding: 0px;
overflow-y: auto;
overflow-x: hidden;
}
#page_2 {
height: 1000px;
background-color: red;
}
<header>
<div id="page_1">
<div id="particles-js">
<div class="row">
<!-- <div class ="logo">
<img src="https://i.imgur.com/0PyA8HR.png" alt="">
</div> -->
<ul class="main-nav">
<li class="active"> HOME </li>
<li> ABOUT </li>
<li> PORTFOLIO </li>
</ul>
</div>
<div class="hero">
<h1>HI I'M KACIE AND I LOVE SOLVING PROBLEMS.</h1>
<div class="button">
LINKEDIN
RESUME
</div>
<div class="bro">
</div>
</div>
</div>
</div>
</header>
<div id=page_2>
</div>
Use position:inherit
You are using fixed and I think that is causing your issue.
Inherit won’t move, absolute stacks, fixed scrolls with page, static is default.

Trying to get all the images to appear horizontally instead of vertically

This is my first ever question on the forum sorry if it is unprofessional hopefully i can learn from my mistakes on this post!!
I put the question in the title but if you have any questions feel free to ask below THANK YOU! for the help!
My Code
html {
font-family: Arial, sans-serif;
}
html,
body {
background-color: #67B177;
margin: 0;
padding: 0;
}
.wrapper {
width: 100%;
background-color: #4B574E;
}
.wrapper_nav {
display: grid;
width: auto;
height: 50px;
}
.wrapper_nav a {
text-decoration: none;
color: white;
padding: 0 1em;
font-size: 30px;
}
.nav_left {
text-align: left;
margin-left: 10%;
margin-top: 0.4em;
}
.nav_right {
float: right;
}
.text {
color: darkslategray;
}
.wrapper_body {}
.text-align-right {
text-align: right;
}
.text-align-center {
text-align: center;
}
h2 {
font-family: helvetica;
font-size: 64px;
text-decoration: none;
color: beige;
margin-top: 50px;
margin-bottom: 50px;
}
h3 {
font-size: 64px;
text-decoration: none;
color: beige;
margin-top: 00;
margin-bottom: 150px;
}
.text2:hover {
color: darkgray;
}
.text3:hover {
color: #67B177;
}
p {
color: beige;
font-family: sans-serif;
font-size: 16px;
}
.object-align-left {
margin-right: 10px;
margin-left: 100px;
width: 50;
}
.object-align-center {
margin-right: 300px;
margin-left: 500px;
}
.object-align-right {
margin-right: 300px;
margin-left: 500px;
}
.overlay {
position: absolute;
bottom: 0;
left: 100%;
right: 0;
background-color: #008CBA;
overflow: hidden;
width: 0;
height: 100%;
transition: .5s ease;
}
.container:hover .overlay {
width: 100%;
left: 0;
}
a {
text-decoration: none;
}
.textone {
margin-left: -170px;
line-height: 100px;
font-family: sans-serif;
color: beige
}
.imageone {
margin-bottom: 50px;
}
.textone:hover {
color: #4B574E;
}
imagegrid {
display: grid;
}
.texttwo {
margin-left: -150px;
line-height: 250px;
font-family: sans-serif;
color: beige;
}
.textthree {
margin-left: -150px;
line-height: 250px;
font-family: sans-serif;
color: beige;
}
.inline-block {
display: inline-block;
}
<html>
<head>
<title>Portfolio</title>
<link rel="stylesheet" type="text/css" href="css/main.css">
</head>
<body>
<div class="wrapper">
<div class="wrapper_nav">
<div class="nav_left">
<div class="text">
<div class="text2">
HOME
EXPERIENCE
CONTACT
ABOUT
LOGIN
</div>
</div>
</div>
</div>
</div>
<div class="text-align-center">
<h2>BUSINESS</h2>
</div>
<div class="inline-block">
<div class="object-align-left">
<div class="container">
<div class="">
<a href="#">
<img src="images/pen-icon.svg" height="200" class="imageone">
<a class="textone"><b>EXPERIMENTAL</b></a>
</a>
</div>
</div>
</div>
<div class="object-align-center">
<a href="#">
<img src="images/logo.svg" height="200">
<a class="texttwo"><b>FAST</b></a>
</a>
</div>
<div class="object-align-right">
<a href="#">
<img src="images/house-309113_1280.png" height="200">
<a class="textthree">INNOVATIVE</a>
</a>
</div>
</div>
<div class="text-align-center">
<h3>FREELANCE WORK</h3>
</div>
</body>
</html>
I did some modification to your code, you can see it here :
HTML:
<div class="wrapper">
<div class="wrapper_nav">
<div class="nav_left">
<div class="text">
<div class="text2">
HOME
EXPERIENCE
CONTACT
ABOUT
LOGIN
</div>
</div>
</div>
</div>
</div>
<div class="section1">
<h2>BUSINESS</h2>
</div>
<div class="section2">
<div class="object">
<a href="#">
<img src="https://dummyimage.com/200x200/4b574e/ffffff.png" height="200">
<a class="textone"><b>EXPERIMENTAL</b></a>
</a>
</div>
<div class="object">
<a href="#">
<img src="https://dummyimage.com/200x200/4b574e/ffffff.png" height="200">
<a class="textone"><b>FAST</b></a>
</a>
</div>
<div class="object">
<a href="#">
<img src="https://dummyimage.com/200x200/4b574e/ffffff.png" height="200">
<a class="textone">INNOVATIVE</a>
</a>
</div>
</div>
<div class="section3">
<h3>FREELANCE WORK</h3>
</div>
CSS :
html{
font-family: Arial,sans-serif;
}
html, body{
background-color:#67B177;
margin: 0;
padding: 0;
}
.wrapper {
width: 100%;
background-color: #4B574E;
}
.wrapper_nav{
display:grid;
width: auto;
height: 50px;
}
.wrapper_nav a{
text-decoration: none;
color: white;
padding: 0 1em;
font-size: 30px;
}
.nav_left{
text-align: left;
margin-left: 10%;
margin-top: 0.4em;
}
.nav_right{
float: right;
}
.text{
color: darkslategray;
}
.wrapper_body{
}
.section1{
text-align: center;
}
.section3{
text-align: center;
display: block;
padding-top: 50px;
clear: both;
overflow: hidden;
}
h2{
font-family:helvetica;
font-size: 64px;
text-decoration:none;
color:beige;
margin-top: 50px;
margin-bottom: 50px;
}
h3{
font-size: 64px;
text-decoration: none;
color: beige;
margin-top: 00;
margin-bottom: 150px;
}
.text2:hover{
color: darkgray;
}
.text3:hover{
color:#67B177;
}
p{
color: beige;
font-family: sans-serif;
font-size: 16px;
}
.overlay {
position: absolute;
bottom: 0;
left: 100%;
right: 0;
background-color: #008CBA;
overflow: hidden;
width: 0;
height: 100%;
transition: .5s ease;
}
.container:hover .overlay {
width: 100%;
left: 0;
}
a{
text-decoration: none;
}
.textone{
font-family:sans-serif;
color: beige;
display: block;
margin-top: 15px;
text-align:center;
}
.imageone{
margin-bottom: 50px;
}
.textone:hover{
color: #4B574E;
}
imagegrid{
display: grid;
}
.section2{
width: 900px;
margin: 0px auto;
}
.object{
float: left;
padding: 0 50px;
}
Code on codepen
https://codepen.io/mehdiyatrib/full/mMOVQK

How to align the classes in one line

I want the div with class name user to be at the top of the page, rather than underneath the card div where it currently is.
I changed the display: to absolute and inline-block and that did not work either.
.card {
opacity: 0.8;
}
.card:hover{
opacity: 1;
}
.card {
height: 450px;
width: 320px;
box-shadow: 1px 1px 20px grey;
word-wrap: break-word;
background-color: #564f4c;
border-radius: 10px;
margin: 12px;
text-align: center;
display: inline-block;
}
img {
width: 100%;
height: 270px;
border-radius: 10px;
}
.info .name {
font-family: Tahoma, Geneva, sans-serif;
text-align: center;
margin-top: 9px;
font-size: 35px;
color: white;
}
.answer, .reject {
text-align: center;
width: 47%;
height: 40px;
color: white;
line-height: 40px;
font-size: 20;
font-family: Verdana, Geneva, sans-serif;
border-style: none;
}
.answer:hover, .reject:hover, .profile:hover {
box-shadow: 1px 2px 3px grey;
cursor: pointer;
}
.answer {
background-color: #3add0d;
display: inline-block;
}
.reject {
display: inline-block;
background-color: #ff2b2b;
}
.phone {
text-align: center;
width: 100%;
margin-top: 15px;
height: 40px;
display: inline-block;
}
.profile {
width: 100%;
height: 40px;
line-height: 40px;
text-align: center;
background-color: #dd520d;
color: white;
/*position: relative;*/
margin-top: 10px;
font-size: 20;
font-family: Verdana, Geneva, sans-serif;
}
.user {
height: 100px;
width: 100px;
background-color: blueviolet;
display: inline-block;
}
<!DOCTYPE html>
<head>
<title>Card</title>
</head>
<body>
<div class="card">
<img src="http://video.blastingnews.com/p/4/2017/02/10/en_gomez090217.jpg" alt="Selena Gomez">
<div class="info">
<div class="name">Selena Gomez</div>
<div class="phone">
<div class="answer">Answer</div>
<div class="reject">Reject</div>
</div>
</div>
<div class="profile">View Profile</div>
</div>
<div class="user">it should be at the top not here</div>
</body>
</html>
After setting up your code in jsFiddle now I see what you want.
Add float: left to .card and .user
Add a wrapper around the entire bit you have and add this class to it:
.clearfix::after {
content: "";
clear: both;
display: table;
}
So with those floats added to your CSS classes your HTML should look like this
<div class="clearfix">
<div class="card">
<img src="http://video.blastingnews.com/p/4/2017/02/10/en_gomez090217.jpg" alt="Selena Gomez">
<div class="info">
<div class="name">Selena Gomez</div>
<div class="phone">
<div class="answer">Answer</div>
<div class="reject">Reject</div>
</div>
</div>
<div class="profile">View Profile</div>
</div>
<div class="user">it should be at the top not here</div>
</div>
<div>
<p>
I'm a new div
</p>
</div>
Anything inside the clearfix div will float, anything outside of it will work as a normal div.
See Fiddle: https://jsfiddle.net/323x9oxm/
Firstly move the <div class="user"> above the <div class="card"> in the HTML, and then remove the display: inline-block; from the .card CSS.
See updated code below:
.card {
opacity: 0.8;
}
.card:hover {
opacity: 1;
}
.card {
height: 450px;
width: 320px;
box-shadow: 1px 1px 20px grey;
word-wrap: break-word;
background-color: #564f4c;
border-radius: 10px;
margin: 12px;
text-align: center;
}
img {
width: 100%;
height: 270px;
border-radius: 10px;
}
.info .name {
font-family: Tahoma, Geneva, sans-serif;
text-align: center;
margin-top: 9px;
font-size: 35px;
color: white;
}
.answer,
.reject {
text-align: center;
width: 47%;
height: 40px;
color: white;
line-height: 40px;
font-size: 20;
font-family: Verdana, Geneva, sans-serif;
border-style: none;
}
.answer:hover,
.reject:hover,
.profile:hover {
box-shadow: 1px 2px 3px grey;
cursor: pointer;
}
.answer {
background-color: #3add0d;
display: inline-block;
}
.reject {
display: inline-block;
background-color: #ff2b2b;
}
.phone {
text-align: center;
width: 100%;
margin-top: 15px;
height: 40px;
display: inline-block;
}
.profile {
width: 100%;
height: 40px;
line-height: 40px;
text-align: center;
background-color: #dd520d;
color: white;
/* position: relative;*/
margin-top: 10px;
font-size: 20;
font-family: Verdana, Geneva, sans-serif;
}
.user {
height: 100px;
width: 100px;
background-color: blueviolet;
display: inline-block;
}
<body>
<div class="user">Look, I'm at the top now.</div>
<div class="card">
<img src="http://video.blastingnews.com/p/4/2017/02/10/en_gomez090217.jpg" alt="Selena Gomez">
<div class="info">
<div class="name">Selena Gomez</div>
<div class="phone">
<div class="answer">Answer</div>
<div class="reject">Reject</div>
</div>
</div>
<div class="profile">View Profile</div>
</div>
</body>
Let me know if you need any other help.

text decoration rule not working?

I am designing my first site... the footer section to be specific. I am trying to style the <a> tags into a white color without the default webkit styling but I am unable to do so.
What am I doing wrong, and how can I change the styling?
* {
margin: 0px;
padding: 0px;
}
div {
display: block;
}
.header {
background-color: #333333;
}
.nav {
padding: 0px auto;
margin: 0px auto;
}
.nav ul {
}
.nav ul li {
color: #e6e6e6;
display: inline-block;
padding: 20px 30px 20px 20px ;
font-family: 'raleway', sans-serif;
font-weight: 20px;
}
.nav ul li a {
text-decoration: none;
color: #efefef;
padding: 20px 20px 20px 20px ;
font-family: 'raleway', sans-serif;
font-weight: 20px;
}
.nav ul li a:hover {
color: #efefef;
background-color: #191919;
transition: background .5s;
}
.second_section .container {
background-image: url(http://1.bp.blogspot.com/-I0jOcWYqW94/UdFZ9U8Si0I/AAAAAAAACRw/2Hhb0xY7yzY/s1600/84.jpg);
height: 900px;
width: 100%;
}
.copy {
position: absolute;
margin: 100px 50px 500px 500px;
color: white;
font-family: 'Josefin Sans', sans-serif;
letter-spacing: 2px
}
.copy {
text-align: center;
}
.btn_section {
top: 400px;
text-align: center;
position: relative;
}
.btn {
position: relative;
margin-top: 100px
color: white;
border: solid 2px fixed;
}
.btn_section a {
border: 1px solid white;
padding: 20px 40px;
text-decoration: none;
background-color: #191919;
color: white;
font-family: 'Open Sans', sans-serif;
font-size: 1.33em;
letter-spacing: 2px;
text-transform: uppercase;
}
.btn_section a:hover {
background-color: #e6e6e6;
color: #191919;
transition: background .5s;
cursor: pointer;
}
.third_section a: hover {
background-color: black;
}
.third_section {
height: 20px;
background-color: black;
}
.fourth_section .col {
display: inline-block;
padding-top: 50px;
padding-bottom: 75px;
padding-left: 6%;
padding-right: 6%;
text-align: center;
font-family: 'Raleway';
width: 20%;
vertical-align: top;
}
.fourth_section img {
padding: 5px 5px 10px 5px;
height: 32px
}
.fourth_section > h2 {
font-family: 'Raleway';
font-size: 1.33em;
}
.col > p {
font-size: 1.12em;
}
.col a {
text-decoration: none;
color: #323232;
}
.col {
text-align: center;
font-family: Garamond;
}
.footer {
height: 100px;
background-color: #333;
padding: 20px;
}
.footer a {
text-decoration: none;
}
.footer_info {
position: relative;
text-decoration: none;
margin-bottom: 10px;
color: white;
}
<div class="header">
<div class="nav">
<ul>
<li>ABOUT</li>
<li>WORK</li>
<li>TEAM</li>
<li>CONTACT</li>
</div>
</div>
<div class="second_section">
<div class="container">
<div class="copy">
<h1>ACTUATE CONTENT</h1>
<br>
<h3>Expert content for every business</h3>
</div>
<div class="btn_section">
Write For Me!
</div>
</div>
<div class="third_section">
</div>
<div class="fourth_section">
<div class="col">
<img src="https://cdn0.iconfinder.com/data/icons/seo-smart-pack/128/grey_new_seo2-17-256.png"><h2>RESEARCH</h2>
<br>
<p>Our meticulous research methods will uncover the most relevant information for your project. </p>
</div>
<div class="col">
<a href="#"><img src="https://cdn2.iconfinder.com/data/icons/55-files-and-documents/512/Icon_17-512.png">
<h2>WRITING</h2></a>
<br>
<p>Our seasoned, handpicked writers craft stellar content for your specific needs.</p>
</div>
<div class="col">
<a href="#"><img src="http://i.imgur.com/AinCaug.png">
<h2>EDITING</h2></a>
<br>
<p>Our editors work with leading authors and publishers to bring out the best in their writing.</p>
</div>
</div>
<div class="footer">
<div class="footer_info">
<p>Terms of Use / Privacy Policy</p>
</div>
</div>
Add your styles into this :
.footer .footer_info a {
...
}

How can I correct the positioning of my footer element?

I want to sharpen my HTML & CSS skills by recreating the Bootstrap homepage in pure HTML & CSS. I am almost finished, but I seem to be having trouble with my footer. Everything else is positioned the way I would like it, but everything on the footer shoots up to the top and middle of my page. Can anyone tell me what I am missing here?
HTML
<header>
<div class="top-bar">
<p>Aww yeah, Bootstrap 4 is coming!</p>
</div>
<nav>
<div class="nav-bar">
<div class="logo">
Bootstrap
</div>
<div class="left-nav">
<ul>
<li>Getting Started</li>
<li>CSS</li>
<li>Components</li>
<li>JavaScript</li>
<li>Customize</li>
</ul>
</div>
<div class="right-nav">
<ul>
<li>Themes</li>
<li>Expo</li>
<li>Blog</li>
</ul>
</div>
</div>
<nav>
</header>
</div>
<center>
<main>
<section>
<div class="head-component">
<div class="b-logo">
<p>B</p>
</div>
<div class="short-description">
<p>Bootstrap is the most popular HTML, CSS, and JS framework for developing responsive, mobile first projects on the web.</p>
</div>
<div class="download-button">
<button class="dwn">Download Bootstrap</button>
</div>
<div class="current">
<p>Currently v3.3.5</p>
</div>
</div>
</section>
<section>
<div class="mid-section">
<div class="mid-info">
<h2>Designed for everyone, everywhere.</h2>
<p>Bootstrap makes front-end web development faster and easier. It's made for folks of all skill levels, devices of all shapes, and projects of all sizes.</p>
</div>
<hr class="hz-line" />
<div class="column-left">
<img src="http://getbootstrap.com/assets/img/sass-less.png" />
<h4>Preprocessors</h4>
<p>Bootstrap ships with vanilla CSS, but its source code utilizes the two most popular CSS preprocessors, Less and Sass. Quickly get started with precompiled CSS or build on the source.</p>
</div>
<div class="column-middle">
<img src="http://getbootstrap.com/assets/img/devices.png" />
<h4>One framework, every device.</h4>
<p>Bootstrap easily and efficiently scales your websites and applications with a single code base, from phones to tablets to desktops with CSS media queries.</p>
</div>
<div class="column-right">
<img src="http://getbootstrap.com/assets/img/components.png" />
<h4>Full of features</h4>
<p>With Bootstrap, you get extensive and beautiful documentation for common HTML elements, dozens of custom HTML and CSS components, and awesome jQuery plugins.</p>
</div>
<div class="clear"></div>
<hr class="hz-line" />
<div class="github">
<p>Bootstrap is open source. It's hosted, developed, and maintained on GitHub.</p>
</div>
<div class="github-button">
<button class="view-git">View the Github Project</button>
</div>
<div class="clear"></div>
<div class="spacer"></div>
<div class="clear"></div>
<div class="photo-section">
<hr class="hrln-full" />
<div class="second-mid-info">
<h2>Built with Bootstrap.</h2>
<p>Millions of amazing sites across the web are being built with Bootstrap. Get started on your own with our growing collection of examples or by exploring some of our favorites.</p>
</div>
<hr class="hz-line" />
<div class="photos">
<img src="http://expo.getbootstrap.com/thumbs/lyft-thumb.jpg" />
<img src="http://expo.getbootstrap.com/thumbs/vogue-thumb.jpg" />
<img src="http://expo.getbootstrap.com/thumbs/riot-thumb.jpg" />
<img src="http://expo.getbootstrap.com/thumbs/newsweek-thumb.jpg" />
</div>
<hr class="hz-line" />
<div class="expo-button">
<p>We showcase dozens of inspiring projects built with Bootstrap on the Bootstrap Expo.</p>
<button class="expo">Explore the Expo</button>
</div>
<hr class="hrln-full" />
</div>
</div>
<div class="clearfooter"></div>
</section>
</main>
<div class="clear"></div>
<footer>
<p>Designed and built with all the love in the world by #mdo and #fat.
<br /> Maintained by the core team with the help of our contributors.
<br /> Code licensed under MIT, documentation under CC BY 3.0.</p>
<ul>
<li>Github</li>
<li>Examples</li>
<li>v2.3.2 docs</li>
<li>About</li>
<li>Expo</li>
<li>Blog</li>
<li>Releases</li>
</ul>
</footer>
</center>
CSS
*, *:before, *:after {
box-sizing: border-box;
}
html, body, #wrap {
height: 100%;
}
body {
margin: 0;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
background-color: #fff;
}
h1 {
font-size: 50px;
}
h2 {
font-size: 40px;
}
h3 {
font-size: 30px;
}
h4 {
font-size: 22px;
font-weight: 100px;
}
h5 {
font-size: 15px;
}
h6 {
font-size: 14px;
}
#container {}
ul {
list-style: none;
}
li {
list-style: none;
display: inline;
padding: 10px;
}
a {
list-style: none;
color: inherit;
text-decoration: none;
padding-top: 15px;
padding-bottom: 15px;
margin: 0;
}
main {
padding-bottom: 150px;
display: block;
margin: 0 auto;
}
.top-bar {
margin: 0;
padding: 15px 0;
background-color: #0275D8;
text-align: center;
}
.top-bar p {
color: #fff;
font-size: 15px;
font-weight: 600;
text-align: center;
margin: 0;
}
.top-bar:hover {
margin: 0;
padding: 15px 0;
background-color: #0269C2;
text-align: center;
}
.nav-bar {
background-color: #fff;
position: relative;
color: #583F7E;
display: block;
width: 100%;
height: 50px;
}
.logo {
position: absolute;
font-size: 20px;
font-weight: 700;
color: #583F7E;
padding: 15px;
line-height: 0.8em;
margin-left: 100px;
}
.left-nav {
float: left;
font-size: 15px;
font-weight: 500;
text-align: center;
margin-left: 200px;
}
.right-nav {
float: right;
text-align: right;
font-size: 15px;
font-weight: 500;
margin-right: 120px;
}
.left-nav a:hover {
background-color: #f9f9f9;
}
.right-nav a:hover {
background-color: #f9f9f9;
}
.head-component {
background-color: #583F7E;
height: 700px;
display: block;
margin: 0 auto;
}
.b-logo {
margin: 0 auto;
padding-top: 5px;
width: 160px;
height: 300px;
display: block;
}
.b-logo p {
font-size: 130px;
font-weight: 700;
color: #fff;
border: 1px solid #fff;
border-radius: 25px;
text-align: center;
}
.short-description {}
.short-description p {
font-size: 30px;
color: #fff;
font-weight: 300;
width: 850px;
text-align: center;
display: block;
margin: 0 auto;
padding-top: 40px;
}
.download-button {
padding-top: 40px;
}
.dwn {
background: none;
font-size: 20px;
padding: 15px;
color: #fff;
font-weight: 400;
border: 1px solid #fff;
border-radius: 5px;
text-align: center;
display: block;
margin: 0 auto;
}
.dwn:hover {
background: #fff;
font-size: 20px;
padding: 15px;
color: #583F7E;
font-weight: 400;
border: 1px solid #fff;
border-radius: 5px;
text-align: center;
display: block;
margin: 0 auto;
}
.current p {
color: #9781A9;
font-size: 14px;
padding-bottom: 75px;
padding-top: 20px;
display: block;
margin: 0 auto;
text-align: center;
}
.mid-section {
height: 100%;
background-color: #fff;
display: block;
margin: 0 auto;
}
.mid-info {
padding-top: 75px;
font-weight: 300;
color: #333;
width: 900px;
text-align: center;
display: block;
margin: 0 auto;
}
.mid-info p {
font-weight: 400;
font-size: 22px;
color: #555;
padding-bottom: 20px;
display: block;
margin: 0 auto;
text-align: center;
}
.hz-line {
width: 10%;
color: #f3f3f3;
opacity: 0.5;
}
.column-left {
width: 32%;
float: left;
padding-top: 25px;
padding-left: 75px;
font-weight: 100;
color: #333;
}
.column-left img {
width: 100%;
}
.column-left p {
font-weight: 400;
font-size: 16px;
color: #555;
padding-bottom: 20px;
}
.column-middle {
width: 32%;
float: left;
padding-top: 25px;
padding-left: 75px;
font-weight: 100;
color: #333;
}
.column-middle img {
width: 100%;
}
.column-middle p {
font-weight: 400;
font-size: 16px;
color: #555;
padding-bottom: 20px;
}
.column-right {
width: 32%;
float: left;
padding-top: 25px;
padding-left: 75px;
font-weight: 100;
color: #333;
}
.column-right img {
width: 100%;
}
.column-right p {
font-weight: 400;
font-size: 16px;
color: #555;
padding-bottom: 20px;
}
.clear {
clear: both;
}
.github {
padding-top: 15px;
font-weight: 300;
color: #333;
width: 1024px;
display: block;
margin: 0 auto;
text-align: center;
}
.github p {
font-weight: 400;
font-size: 18px;
color: #555;
padding-bottom: 20px;
text-align: center;
}
.view-git {
background: none;
font-size: 20px;
padding: 10px;
color: #583F7E;
font-weight: 400;
border: 1px solid #583F7E;
border-radius: 5px;
text-align: center;
display: block;
margin: 0 auto;
}
.view-git:hover {
background: #583F7E;
font-size: 20px;
padding: 10px;
color: #fff;
font-weight: 400;
border: 1px solid #fff;
border-radius: 5px;
text-align: center;
display: block;
margin: 0 auto;
}
.hrln-full {
color: #f3f3f3;
opacity: 0.5;
}
.spacer {
height: 60px;
}
.second-mid-info {
padding-top: 75px;
font-weight: 300;
color: #333;
width: 900px;
display: block;
margin: 0 auto;
text-align: center;
}
.second-mid-info p {
font-weight: 400;
font-size: 22px;
color: #555;
text-align: center;
display: block;
margin: 0 auto;
padding-bottom: 30px;
}
.photo-section {
height: 100%;
display: block;
margin: 0 auto;
}
.photos {
padding: 30px;
padding-left: 115px;
}
.photos img {
width: 23%;
}
.expo-button {
padding-top: 15px;
padding-bottom: 120px;
font-weight: 300;
color: #333;
width: 1024px;
display: block;
margin: 0 auto;
}
.expo-button p {
font-weight: 300;
font-size: 22px;
color: #555;
padding-bottom: 30px;
text-align: center;
display: block;
margin: 0 auto;
}
.expo {
background: none;
font-size: 20px;
padding: 10px;
color: #583F7E;
font-weight: 400;
border: 1px solid #583F7E;
border-radius: 5px;
text-align: center;
display: block;
margin: 0 auto;
}
.expo:hover {
background: #583F7E;
font-size: 20px;
padding: 10px;
color: #fff;
font-weight: 400;
border: 1px solid #fff;
border-radius: 5px;
text-align: center;
display: block;
margin: 0 auto;
}
.clearfooter {
height: 130px;
clear: both;
}
footer {
text-align: center;
bottom: 0;
height: 100%;
left: 0;
width: 100%;
display: block;
margin: 0 auto;
}
footer p {
text-align: center;
}
footer ul {
position: relative;
}
footer li {
color: #489FD6;
}
footer li:hover {
color: #23517C;
text-decoration: underline;
}
footer a {}
From what I can tell I believe its because of two main reasons.
You have set fixed heights for elements with content that is height than the fixed height.
.mid-section {
height: 500px;
background-color: #fff;
margin: 0;
}
.photo-section {
height:500px;
}
The footer has position: absolute but isn't contained by a parent with position: relative. If you would like the footer to stick to the bottom use position: fixed instead.
footer {
text-align: center;
bottom: 0;
height: 100px;
left: 0;
position: absolute;
width: 100%;
}