adding my logo in my navigation - html

I'm currently studying web development so I'm practising some html and css.
I'm having problems placing my logo on the left.
what I wish to accomplish is something like this:
prototype navigation
I have a logo on the left side of my navigation bar and on my right is my navigation menus home, partners and products that turns into a hamburger menu when the width of the screen decreases.
Can you please help me out or point me to a good resource to get my layouts properly done? thank you all in advance.
Here is my HTML code:
.menu {
margin: 0 30px 0 0;
background-color: #f8f5f2;
overflow: hidden;
position: fixed;
top: 0;
width: 100%;
}
.menu a {
text-decoration: none;
color:black;
margin: 0 10px;
line-height: 70px;
font-family: playfair-display
}
span {
color: dodgerblue;
}
label {
margin: 0 40px 0 0;
font-size: 26px;
line-height: 70px;
display: none;
width: 20px;
float: right;
}
#toggle {
display: none;
}
#media only screen and (max-width: 500px) {
label{
display: block;
cursor: pointer;
}
.menu {
text-align: center;
width: 100%;
display: none;
}
.menu a {
clear: right;
display: block;
border-bottom: 1px solid black;
margin: 0;
}
#toggle: checked + .menu {
display: block;
}
}
<header>
<div class="nav">
<div id="logo">
<img src="img/logoblackandred.png" alt="logo">
</div>
<label for="toggle">☰</label>
<input type="checkbox" id="toggle" />
<div class="menu">
Home
Partners
<span>Products</span>
</div>
</div>
</header>

Try
img{
display:inline;
width:70px;
height:50px;
float:left;
}

Like this?
I removed the position: fixed and added display: inline to #logo and #menu
.menu {
margin: 0 30px 0 0;
background-color: #f8f5f2;
overflow: hidden;
width: 100%;
display: inline;
}
.menu a
{
text-decoration: none;
color:black;
margin: 0 10px;
line-height: 70px;
font-family: playfair-display
}
span
{
color: dodgerblue;
}
label
{
margin: 0 40px 0 0;
font-size: 26px;
line-height: 70px;
display: none;
width: 20px;
float: right;
}
#toggle
{
display: none;
}
#logo {
display: inline;
}
#media only screen and (max-width: 500px)
{
label
{
display: block;
cursor: pointer;
}
.menu
{
text-align: center;
width: 100%;
display: none;
}
.menu a
{
clear: right;
display: block;
border-bottom: 1px solid black;
margin: 0;
}
#toggle: checked + .menu
{
display: block;
}
}
<header>
<div class="nav">
<div id="logo">
<img src="https://cdn.sstatic.net/Sites/stackoverflow/company/img/logos/so/so-logo.png?v=9c558ec15d8a" alt="logo" width="200px">
</div>
<label for="toggle">☰</label>
<input type="checkbox" id="toggle" />
<div class="menu">
Home
Partners
<span>Products</span>
</div>
</div>
</header>

I change Html code little , and added to css code a few line.
This is Demo
.menu
{
margin: 0 30px 0 0;
background-color: #f8f5f2;
overflow: hidden;
position: fixed;
top: 0;
width: 100%;
}
.menu a
{
text-decoration: none;
color:black;
margin: 0 10px;
line-height: 70px;
font-family: playfair-display
}
span
{
color: dodgerblue;
}
label
{
margin: 0 40px 0 0;
font-size: 26px;
line-height: 70px;
display: none;
width: 20px;
float: right;
}
#toggle
{
display: none;
}
.logo {
display: none;
}
.lg-logo {
float: left;
display: inline-block;
width: 50px;
margin-top: 15px;
}
#media only screen and (max-width: 500px)
{
label
{
display: inline-block;
cursor: pointer;
vertical-align: middle;
}
.menu
{
text-align: center;
width: 100%;
display: none;
}
.menu a
{
clear: right;
display: block;
border-bottom: 1px solid black;
margin: 0;
}
#toggle: checked + .menu
{
display: block;
}
.logo {
float: left;
display: inline-block;
width: 50px;
margin-top: 15px;
}
}
<header>
<div class="nav">
<div id="logo">
<img class="logo" src="http://pngimg.com/uploads/car_logo/car_logo_PNG1640.png" alt="logo">
</div>
<label for="toggle">☰</label>
<input type="checkbox" id="toggle" />
<div class="menu">
Home
Partners
<span>Products</span>
<img class="lg-logo" src="http://pngimg.com/uploads/car_logo/car_logo_PNG1640.png" alt="logo">
</div>
</div>
</header>
Note : Resize Browser and see result.

Try checking below code jsfiddle link.
You can change the width for logo id and menu class https://jsfiddle.net/pradeepv/yxnLs89h/

Please relpace this code with your old code.
.menu
{
margin: 0 30px 0 0;
background-color: #f8f5f2;
overflow: hidden;
position: fixed;
top: 0;
width: 100%;
}
.menu a
{
text-decoration: none;
color:black;
margin: 0 10px;
line-height: 70px;
font-family: playfair-display
}
span
{
color: dodgerblue;
}
label
{
margin: 0 40px 0 0;
font-size: 26px;
line-height: 70px;
display: none;
width: 20px;
float: right;
}
#toggle
{
display: none;
}
.logo {
display: none;
}
.lg-logo {
float: left;
display: inline-block;
width: 50px;
margin-top: 15px;
}
#media only screen and (max-width: 500px)
{
label
{
display: inline-block;
cursor: pointer;
vertical-align: middle;
}
.menu
{
text-align: center;
width: 100%;
display: none;
}
.menu a
{
clear: right;
display: block;
border-bottom: 1px solid black;
margin: 0;
}
#toggle: checked + .menu
{
display: block;
}
.logo {
float: left;
display: inline-block;
width: 50px;
margin-top: 15px;
}
}
<div class="nav">
<div id="logo">
<img class="logo" src="http://pngimg.com/uploads/car_logo/car_logo_PNG1640.png" alt="logo">
</div>
<label for="toggle">☰</label>
<input type="checkbox" id="toggle" />
<div class="menu">
Home
Partners
<span>Products</span>
<img class="lg-logo" src="https://en.facebookbrand.com/wp-content/themes/fb-branding/prj-fb-branding/assets/images/thumb-drawn.svg" alt="logo">
</div>
</div>

Related

There is a small gap after the navigation

I have a navigation bar which is OK, but just underneath that there is a 1px line that I cannot get rid of, it should be flush with the address underneath. This is the code that I have can anyone suggest anything?
There is also some of the html which was so hard formatting on here anyhow they want me to add more text. So it is the address underneath the naviation
address.space {
width: 100%;
background: #FF9900;
font-family: 'Monserrat', sans-serif;
text-align: center;
display: inline-block;
font-size: 1em;
margin-bottom: 20px;
}
/*menu*/
.nav {
background-color: #3333FF;
width: 100%;
height: 40px;
line-height: 40px;
}
.menu {
font-family: Monserrat, sans-serif;
font-size: 20px;
color: white;
list-style-type: none;
padding: 0;
position: relative;
z-index: 1;
}
.menu a {
text-decoration: none;
color: #fff;
line-height: 40px;
height: 40px;
display: block;
}
.menu ul li {
text-align: center;
display: inline-block;
padding: 0 20px 0 20px;
width: 13.5%;
height: 40px;
}
.menu li:visited,
.menu li:active,
.active,
.menu li:hover {
background: #0000EE;
color: #fff;
}
label {
margin: 0 14px 0 0;
font-size: 20px;
display: none;
}
#toggle {
display: none;
}
#media only screen and (max-width: 500px) {
html,
body,
#main,
#firstside,
.firstsidewider,
#second,
.wide {
width: 100%;
font-size: 1em;
}
h1 span {
display: none;
}
label {
cursor: pointer;
display: block;
color: #fff;
}
.menu {
text-align: center;
width: 100%;
display: none;
}
.menu li a {
border-bottom: 1px solid #F4F4F4;
display: block;
background: #3333FF;
margin: -20px;
padding: 0;
}
.active,
.menu li:hover {
color: #fff;
background: 0;
}
#toggle:checked+.menu {
display: block;
}
<header id="banner">
<div class="nav">
<label for="toggle">☰</label><input id="toggle" type="checkbox">
<div class="menu">
<ul>
<li>Home</li>
<li>News</li>
<li>Contacts
</li>
<li>Members
</li>
<li>Policies
</li>
<li>Links</li>
<li class="active">
Volunteer/li>
</ul>
</div>
</div>
<address class="space">
Meeting Address: YMCA -The Lecture Room 29 Rush Green
Road
4.00pm - 6.00pm</address>
<section id="leftheader">
<h1>Hubb <span>support group</span></h1>

How to make my navigation bar menu button work?

i dont know why my button dont show the menu when clicked ;
i try almost everything i know, but i cant define my problem.
i use the "checkbox" trick to show the hamburger button when the site go under 500 px to show a resposive menu but i dont know w
i searched on google and youtube mìbut nothing i can help me put
HTML
<header>
<ul>
<!-- ho aggiunto checkbox,toggle(bottone menu, id carrellore(carrello che compare con la mediaquery -->
<input type="checkbox" id="toggle"/>
<p id="carrellore"><img src="./images/carrello.png"></p>
<label for="toggle">☰</label>
<!-- ho aggiunto checkbox,toggle(bottone menu, id carrellore(carrello che compare con la mediaquery -->
<li>HOME<li>
<li>CATALOGO<li>
<% if ((session.getAttribute("login_result")!=null) && ((Boolean)(session.getAttribute("login_result")))) {%>
<li>PROFILO<li>
<%} else { %>
LOGIN<li>
<%} %>
<li id="carrello"><img src="./images/carrello.png"></li>
</ul>
<div id="spazio">Spazio libero<br><br></div>
</header>
CSS
header ul {
list-style-type: none;
margin: 0;
padding: 0;
background-color: #000000;
width: 100%;
position: fixed;
top: 0;
left: 0;
}
header li {
float: left;
}
header li a {
display: block;
text-decoration: none;
color: white;
padding: 15px 15px;
font-family: "Lato", sans-serif;
}
header li a:hover {
background-color: #0080ff;
}
label {
margin: 0 40px 0 0;
font-size: 30px;
line-height: 70px;
display: none;
width: 14px;
float: center;
color: #ffffff;
}
#toggle {
display:none;
}
#carrello {
float: right;
}
#carrello img {
height: 18px;
width: auto;
object-fit: contain;
}
#carrellore {
float:right;
display:none;
}
#carrellore img {
height: 30px;
width: auto;
object-fit: contain;
}
#spazio {
margin-top: 25px;
visibility: hidden;
}
#logo {
display: block;
margin: auto;
}
/* mediaquery per rendere il sito responsive */
#media only screen and (max-width: 500px) {
#spazio {
margin-top: 50px;
visibility: hidden;
}
#carrellore {
display: block;
cursor: pointer;
}
label {
display: block;
cursor: pointer;
float: center;
}
header li {
background-color: #000000;
color: white;
text-align: center;
width: 100%;
display: none;
}
header li a {
background-color: #000000;
display: block;
border-bottom: 1px solid #EAEAEB;
margin: 0;
}
#toggle:checked + header li a {
display:block ;
}
“I’m setting up a new server, and want to support UTF-8 fully in my web application. Where do I need to set the encoding/charsets?”
}
the button dont trigger at all but the checkbox check
Try this code..
HTML
<header>
<ul>
<input type="checkbox" id="toggle"/>
<p id="carrellore"><img src="./images/carrello.png"></p>
<label for="toggle">☰</label>
<ul class="menu">
<li>HOME<li>
<li>CATALOGO<li>
<% if ((session.getAttribute("login_result")!=null) && ((Boolean)(session.getAttribute("login_result")))) {%>
<li>PROFILO<li>
<%} else { %>
LOGIN<li>
<%} %>
<li id="carrello"><img src="./images/carrello.png"></li>
</ul>
<div id="spazio">Spazio libero<br><br></div>
</header>
**CSS**
header ul {
list-style-type: none;
margin: 0;
padding: 0;
background-color: #000000;
width: 100%;
position: fixed;
top: 0;
left: 0;
}
header li {
float: left;
}
header li a {
display: block;
text-decoration: none;
color: white;
padding: 15px 15px;
font-family: "Lato", sans-serif;
}
header li a:hover {
background-color: #0080ff;
}
label {
margin: 0 40px 0 0;
font-size: 30px;
line-height: 70px;
display: none;
width: 14px;
float: center;
color: #ffffff;
}
#toggle {
display:none;
}
#carrello {
float: right;
}
#carrello img {
height: 18px;
width: auto;
object-fit: contain;
}
#carrellore {
float:right;
display:none;
}
#carrellore img {
height: 30px;
width: auto;
object-fit: contain;
}
header {
padding-top: 66px;
}
body {
margin: 0px;
}
#logo {
display: block;
margin: auto;
}
/* mediaquery per rendere il sito responsive */
#media only screen and (max-width: 500px) {
#spazio {
margin-top: 50px;
visibility: hidden;
}
#carrellore {
display: block;
cursor: pointer;
}
label {
display: block;
cursor: pointer;
float: center;
}
header ul.menu {
display: none;
}
header li {
background-color: #000000;
color: white;
text-align: center;
width: 100%;
}
header li a {
background-color: #000000;
display: block;
border-bottom: 1px solid #EAEAEB;
margin: 0;
}
#toggle:checked + header li a {
display:block ;
}
}
JQUERY
<script type="text/javascript">
$('body').on('click','label',function() {
$('.menu').slideToggle();
});
</script>

Problems with position: absolute when applying it

I'm trying to create a navbar whith white bars on top of the options, but the position: absolute is not responding as I expect, even if I place it after a position: relative, the white bars are wider than the width of the options:As you can see here
This is the code I'm following from the tutorial, I would appreciate your help.
body {
margin: 0;
background: #222;
font-family: sans-serif;
font-weight: 400;
}
.container {
width: 80%;
margin: 0 auto;
}
header {
background: #151515;
}
.logo {
float: left;
padding: 10px 0;
}
nav {
float: right;
}
nav ul {
margin: 0;
padding: 0;
list-style: none;
}
nav li {
display: inline-block;
margin-left: 70px;
padding: 40px;
position: relative;
}
nav a {
color: white;
text-decoration: none;
}
nav a:hover {
color: black;
}
nav a::before {
content: '';
display: block;
height: 5px;
background-color: white;
position: absolute;
top: 0;
width: 100%;
}
<header>
<div class="container">
<img src="img1.png" style="max-width: 80px; margin-top: 0px;" alt="logo" class="logo">
<nav>
<ul>
<li>CONTACTO</li>
<li>REGISTRATE</li>
<li>INGRESAR</li>
</ul>
</nav>
</div>
</header>
Another way to achieve the same:
Instead of using the pseudo element, you can use the property border-top along with padding-top to achieve the same, if what you need is the border width to be equal with the length of the option.
body {
margin: 0;
background: #222;
font-family: sans-serif;
font-weight: 400;
}
.container {
width: 80%;
margin: 0 auto;
}
header {
background: #151515;
}
.logo {
float: left;
padding: 10px 0;
}
nav {
float: right;
}
nav ul {
margin: 0;
padding: 0;
list-style: none;
}
nav li {
display: inline-block;
margin-left: 70px;
padding: 40px;
position: relative;
}
nav a {
color: white;
text-decoration: none;
border-top:5px solid #fff;
padding-top:10px;
}
nav a:hover {
color: black;
}
/*
nav a::before {
content: '';
display: block;
height: 5px;
background-color: white;
position: absolute;
top: 0;
width: 100%;
}*/
<header>
<div class="container">
<img src="img1.png" style="max-width: 80px; margin-top: 0px;" alt="logo" class="logo">
<nav>
<ul>
<li>CONTACTO</li>
<li>REGISTRATE</li>
<li>INGRESAR</li>
</ul>
</nav>
</div>
</header>
Here is another way, in-case you need the width of all borders be same. You must give a fixed width to the pseudo element, instead of 100%.
body {
margin: 0;
background: #222;
font-family: sans-serif;
font-weight: 400;
}
.container {
width: 80%;
margin: 0 auto;
}
header {
background: #151515;
}
.logo {
float: left;
padding: 10px 0;
}
nav {
float: right;
}
nav ul {
margin: 0;
padding: 0;
list-style: none;
}
nav li {
display: inline-block;
margin-left: 70px;
padding: 40px;
position: relative;
}
nav a {
color: white;
text-decoration: none;
}
nav a:hover {
color: black;
}
nav a::before {
content: '';
display: block;
height: 5px;
background-color: white;
position: absolute;
top: 0;
/*width: 100%;*/
width: 100px;
}
<header>
<div class="container">
<img src="img1.png" style="max-width: 80px; margin-top: 0px;" alt="logo" class="logo">
<nav>
<ul>
<li>CONTACTO</li>
<li>REGISTRATE</li>
<li>INGRESAR</li>
</ul>
</nav>
</div>
</header>
Your line item element is wider than your link element which means that your white bar will copy the relatively positioned line item's width. If you look in inspector you can see this clearly.
The width
Use the border-top property instead on your links.
nav a{
color: white;
text-decoration: none;
border-top: solid 3px #fff;
padding-top: 35px
}
nav a:hover {
color: black;
}
nav a::before {
}
On nav a:before :
If you want to create it the same width as your text - substract the padding:
width: calc(100% - 80px);
or you want to place it the same size as your li item use:
left: 0;
You have to account for the 40px * 2 = 80 px of padding you have added to the li element.
body {
margin: 0;
background: #222;
font-family: sans-serif;
font-weight: 400;
}
.container {
width: 80%;
margin: 0 auto;
}
header {
background: #151515;
}
.logo {
float: left;
padding: 10px 0;
}
nav {
float: right;
}
nav ul {
margin: 0;
padding: 0;
list-style: none;
}
nav li {
display: inline-block;
margin-left: 70px;
padding: 40px;
position: relative;
}
nav a {
color: white;
text-decoration: none;
}
nav a:hover {
color: black;
}
nav a::before {
content: '';
display: block;
height: 5px;
background-color: white;
position: absolute;
top: 0;
width: calc(100% - 80px);
}
<header>
<div class="container">
<img src="img1.png" style="max-width: 80px; margin-top: 0px;" alt="logo" class="logo">
<nav>
<ul>
<li>CONTACTO</li>
<li>REGISTRATE</li>
<li>INGRESAR</li>
</ul>
</nav>
</div>
</header>
body {
margin: 0;
background: #222;
font-family: sans-serif;
font-weight: 400;
}
.container {
width: 80%;
margin: 0 auto;
}
header {
background: #151515;
}
.logo {
float: left;
padding: 10px 0;
}
nav {
float: right;
}
nav ul {
margin: 0;
padding: 0;
list-style: none;
}
nav li {
display: inline-block;
/*delete padding */
margin-left: 70px;
position: relative;
}
nav a {
color: white;
text-decoration: none;
/*add this */
padding: 40px 0;
display: inline-block;
border-top: 5px solid transparent;
}
nav a:hover {
color: black;
/*and this*/
border-top: 5px solid white;
}
/*
nav a::before {
content: '';
display: block;
height: 5px;
background-color: white;
position: absolute;
top: 0;
width: 100px;
}
*/
<header>
<div class="container">
<img src="img1.png" style="max-width: 80px; margin-top: 0px;" alt="logo" class="logo">
<nav>
<ul>
<li>CONTACTO</li>
<li>REGISTRATE</li>
<li>INGRESAR</li>
</ul>
</nav>
</div>
</header>
The nav a::before pseudo-element is a child of a::before. Pseudo-elements like ::before or ::hover are always children of the elements whose selectors preface them. You need to put the position:relative property on the rule for nav a. Currently, you have the position:relative property on the li element, which is wider than the a element.
You'll also need to add some other property to raise the line. I've added padding-top to solve that problem.
body {
margin: 0;
background: #222;
font-family: sans-serif;
font-weight: 400;
}
.container {
width: 80%;
margin: 0 auto;
}
header {
background: #151515;
}
.logo {
float: left;
padding: 10px 0;
}
nav {
float: right;
}
nav ul {
margin: 0;
padding: 0;
list-style: none;
}
nav li {
display: inline-block;
margin-left: 70px;
padding: 40px;
position: relative;
}
nav a {
position: relative;
padding-top: 20px;
color: white;
text-decoration: none;
}
nav a:hover {
color: black;
}
nav a::before {
content: '';
display: block;
height: 5px;
background-color: white;
position: absolute;
top: 0;
width: 100%;
}
<header>
<div class="container">
<img src="img1.png" style="max-width: 80px; margin-top: 0px;" alt="logo" class="logo">
<nav>
<ul>
<li>CONTACTO</li>
<li>REGISTRATE</li>
<li>INGRESAR</li>
</ul>
</nav>
</div>
</header>

HTML/CSS Navbar out of order

I'm attempting to create a navbar with two dropdown menus and after lots of fiddling with the dropdown menu I've got it sorta working. But it's made the rest of the items out of order.
https://jsfiddle.net/o5pcs1y7/
body {
font-family: Arial;
background-color: #FAFAFA;
}
.container {
width: 960px;
position: relative;
margin-left: auto;
margin-right: auto;
background-color: #FAFAFA;
padding: 10px 10px 10px;
}
.header h1 {
border-bottom: solid 2px #2c3840;
text-transform: uppercase;
color: #2c3840;
}
.header img {
float: right;
position: relative;
width: 90px;
margin-top: -60px;
}
.nav {
background-color: #2c3840;
position: relative;
width: 100%;
float: left;
height: 41px;
margin-top: -22px;
}
.nav a {
font-family: Arial;
float: left;
display: inline-block;
color: #FAFAFA;
text-align: center;
padding: 10px 14px;
text-decoration: none;
font-size: 18px;
}
.nav a:hover {
background-color: #6d4b4f;
}
.projects {
position: relative;
display: inline-block;
}
.projects-content {
display: none;
position: absolute;
background-color: #FAFAFA;
min-width: 160px;
padding: 10px 14px;
z-index: 1;
text-decoration: none;
}
.projects:hover .projects-content {
display: block;
}
.services {
position: relative;
display: inline-block;
}
.services-content {
display: none;
position: absolute;
background-color: #FAFAFA;
min-width: 160px;
padding: 12px 16px;
z-index: 1;
text-decoration: none;
}
.services:hover .services-content {
display: block;
}
<!doctype html>
<title>Werribee Roadworthy Centre</title>
<link rel="shortcut icon" type="image/png" href="favicon.png" />
<body>
<div class="container">
<div class="header">
<h1>Werribee Roadworthy Centre</h1>
<img src="car.png">
</div>
<div class="nav">
Home
<div class="services">
Services
<div class="services-content">
1
2
3
</div>
</div>
<div class="projects">
Projects
<div class="projects-content">
1
2
3
</div>
</div>
Photo Gallery
Contact Us
</div>
<div class="section">
</div>
<div class="aside">
</div>
</div>
</body>
This is the code. The ordering of the navbar is correct in the HTML just not in the finished product. Also don't mind the broken dropdown.
Since the parent .nav could have a child of div or either a, you didn't float the div to left like you float a and that what was making the mess:
you just have to add:
.nav > div {
float: left;
}
body {
font-family: Arial;
background-color: #FAFAFA;
}
.container {
width: 960px;
position: relative;
margin-left: auto;
margin-right: auto;
background-color: #FAFAFA;
padding: 10px 10px 10px;
}
.header h1 {
border-bottom: solid 2px #2c3840;
text-transform: uppercase;
color: #2c3840;
}
.header img {
float: right;
position: relative;
width: 90px;
margin-top: -60px;
}
.nav {
background-color: #2c3840;
position: relative;
width: 100%;
float: left;
height: 41px;
margin-top: -22px;
}
.nav a {
font-family: Arial;
float: left;
display: inline-block;
color: #FAFAFA;
text-align: center;
padding: 10px 14px;
text-decoration: none;
font-size: 18px;
}
.nav > div {
float: left;
}
.nav a:hover {
background-color: #6d4b4f;
}
.projects {
position: relative;
display: inline-block;
}
.projects-content {
display: none;
position: absolute;
background-color: #FAFAFA;
min-width: 160px;
padding: 10px 14px;
z-index: 1;
text-decoration: none;
}
.projects:hover .projects-content {
display: block;
}
.services {
position: relative;
display: inline-block;
}
.services-content {
display: none;
position: absolute;
background-color: #FAFAFA;
min-width: 160px;
padding: 12px 16px;
z-index: 1;
text-decoration: none;
}
.services:hover .services-content {
display: block;
}
<!doctype html>
<title>Werribee Roadworthy Centre</title>
<link rel="shortcut icon" type="image/png" href="favicon.png" />
<body>
<div class="container">
<div class="header">
<h1>Werribee Roadworthy Centre</h1>
<img src="car.png">
</div>
<div class="nav">
Home
<div class="services">
Services
<div class="services-content">
1
2
3
</div>
</div>
<div class="projects">
Projects
<div class="projects-content">
1
2
3
</div>
</div>
Photo Gallery
Contact Us
</div>
<div class="section">
</div>
<div class="aside">
</div>
</div>
</body>
Hope this helps :)

CSS : How do I line up the elements in my header using css?

I want all the elements in my header to be in a horizontal line in line with each other. I also want them to be centered on the Grey header block. Here is what it looks like so far.enter image description here This is my first website so I'm just playing around at the moment so I would appreciate any help or advice.
*
====================================
HEADER
====================================
*/
header {
background-color: grey;
opacity: 50%;
width: 100%;
}
#logo {
float: left;
padding-top: 10px;
padding-left: 30px;
}
#logo img {
width: 15%;
height: 15%;
}
#navigation {
margin: auto;
clear: both;
text-align: center;
position: relative;
}
#navigation li {
display: inline-block;
padding: 5px 15px 5px 15px;
color: #fff;
}
#navigation li a {
color: #fff;
text-transform: uppercase;
}
nav a.selected, nav a:hover {
border-bottom: 1px solid #fff;
padding-bottom: 0.75px;
}
.social-media {
text-align: right;
padding: 0 1.5em 0 0;
}
.social-media ul li {
display: inline;
}
.social-media img {
width: 30px;
height: 30px;
margin: 0 4px;
}
<header>
<div id="logo">
<img src="img/logo.png">
</div>
<nav id="main-controls">
<ul id="navigation">
<li>Home</li>
<li>About</li>
<li>Portfolio</li>
<li>Services</li>
<li>Contact</li>
</ul>
<div class="social-media">
<img src="img/facebook.png" alt="Facebook">
<img src="img/twitter.png" alt="Twitter">
<img src="img/instagram.png" alt="Instagram">
<img src="img/google+.png" alt="Google Plus">
<img src="img/linkedin.png" alt="Linked In">
</div>
</nav>
</header>
An updated version of your CSS:
*
====================================
HEADER
====================================
*/
header {
background-color: grey;
opacity: 50%;
width: 100%;
}
#logo {
display: inline-block;
padding-top: 10px;
padding-left: 30px;
}
#logo img {
width: 15%;
height: 15%;
}
#navigation {
display: inline-block;
margin: auto;
clear: both;
text-align: center;
position: relative;
}
#navigation li {
display: inline-block;
padding: 5px 15px 5px 15px;
color: #fff;
}
#navigation li a {
color: #fff;
text-transform: uppercase;
}
nav a.selected, nav a:hover {
border-bottom: 1px solid #fff;
padding-bottom: 0.75px;
}
.social-media {
display: inline-block;
text-align: right;
padding: 0 1.5em 0 0;
}
.social-media ul li {
display: inline-block;
}
.social-media img {
width: 30px;
height: 30px;
margin: 0 4px;
}
This should take care of aligning all elements horizontally. I removed a float property declared, and used display: inline-block instead on all stacked elements.