Bootstrap Nav link not opening or working [duplicate] - html

This question already has answers here:
Bootstrap Navbar. When I press the button nothing happens
(2 answers)
Closed 6 years ago.
I am having problems with the bootstrap nav. I am using this nav for mobile phones, otherwise it is not visible. Logo on the left works but the button on the right does not. I cannot find what is the problem.
HTML:
<nav class="navbar navbar-default navbar-fixed-top mobile" role="navigation" style="visibility:hidden;">
<div class="container">
<div class="navbar-header page-scroll">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar" style="background-color:white"></span>
<span class="icon-bar" style="background-color:white"></span>
<span class="icon-bar" style="background-color:white"></span>
</button>
<a class="navbar-brand page-scroll" href="#page-top" style="color:white"><img class="pull-left" style="max-width:100px; margin-top: -7px;" src="theme/logo.png"></a>
</div>
<!--Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse navbar-ex1-collapse">
<ul class="nav navbar-nav">
<li class="active">Home</li>
<li>Page 1</li>
<li>Page 2</li>
<li>Page 3</li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container -->
</nav>
</code>
And CSS:
<pre>#import url(http://fonts.googleapis.com/css?family=PT+Sans:400,700,400italic);
html, body {
height: 100%;
overflow: hidden;
}
:link,:visited {text-decoration:none}
h1,h2,h3,h4,h5,h6,pre,code {font-size:48px;font-weight:400; margin-top: 0; margin-bottom: 0.5em;}
h2 { line-height: 1em; margin-bottom: 0.5em; }
ul,dl,dt,dd,ol,li,/*h1,h2,h3,h4,h5,h6,*/pre,form,body,html,p,blockquote,fieldset,input {margin:0; padding:0}
h3, h4 { font-size:30px; line-height: 1em; margin-bottom:0.5em;}
a img,:link img,:visited img {border:none}
p {margin-bottom: 0.5em;}
hr { margin: 25px 0; height: 1px;
background-color: #333333;
border:1px solid #ffffff;
}
.strong { font-weight: bold; }
/** GLOBAL SETS **/
div { display: block; }
.clear {clear:both;}
.hidden {display:none;}
body {margin:0 0 50px 0;font-size:26px;color:#17331f;font-family:'PT Sans',lucida,tahoma, helvetica, verdana;background:#ffffff;text-align:left; }
a:link, a:visited {color: #253066; text-decoration:underline;}
a:hover, a:focus {text-decoration:none;}
#yhteysheader a:link, #yhteysheader a:visited {color: #ffffff; text-decoration:underline;}
#wrapper {position: fixed;top:185px;width:100%;margin:0 auto;display:block;height: 100%; overflow:auto;}
p, h1, h2 {
padding-left: 20px;
padding-right: 20px;
}
p {
font-size: 18px;
}
#header {top: 0px;
left: 0px;
right: 0px;
position: fixed; display:block;
z-index: 100;height:165px; text-align: left; background:#17331f; box-shadow: 2px 2px 2px #253066; margin:0; padding: 0;}
.contain { width: 1080px; margin: 0 auto;}
.sisalto { min-height: 600px; height: auto; margin-bottom: 35px; margin-top: 14px; /*background: url(images/rattitausta.png) top left no-repeat;*/ }
/*div.topfix { padding-top:105px; }
div.topfix_hist { padding-top:75px; }*/
div.left { float: left; height: 100%; margin: 10px; }
div.right { float: right; height: auto; }
.teksti { width: 760px; }
.tekstikapea { width: 500px; }
.tekstikeski { width: 630px; }
.kuvakeski { width: 375px; }
.kuva { width: 100%; }
.kuvalevea { width: 500px; }
.kuva img { width: 100%; }
isokuva
#menu { display: block;position: relative;height: auto; margin-top: 70px; width: 680px; float: right;}
#menu ul#nav {display: block;position:relative;list-style:none; margin-bottom: 0;height:auto;height:0; padding:0; float: right;}
#menu #nav li {float:left;margin:0;font-size:18px;font-weight:normal;}
#menu #nav li a {display:block;line-height:20px;padding:10px 20px;}
#menu #nav li.firstli a { }
#menu #nav li a:link, #menu #nav li a:visited {color:#ffffff;text-decoration:none;}
#menu #nav li a:hover, #menu #nav li a:focus {color:#FFFFFF;text-decoration:none;}
#menu #nav li.current a {border:1px solid #FFC4C4;color:#FFFFFF;text-decoration:none;}
h1#logo { position: relative; margin: 0; padding: 0; margin-top: 0; display: block; width: 400px; height: 132px; background: transparent url(logo.png); visibility: visible; border: 0;overflow: hidden; z-index: 999: text-align: left; float: left; clear: none !important; }
h1#logo a {
display: block;
text-decoration: none;
overflow: hidden;
border: 0;
height: 132px;
height: 0px !important;
padding-top: 132px;
cursor: pointer;
width: 400px;
clear: none;
}
h1#slogan { color: #ffffff; font-size: 26px; float: left; clear: right;padding-top:10px; margin-bottom: 0; display: block; }
#yhteysheader {
margin-top: 10px;
font-size: 14px;
font-weight: normal;
float: left;
clear: both;
color: #ffffff;
}
#page-content {text-align: left; margin-top 35px; }
#media only screen and (max-width: 1199px) {
#header {
height: 160px;
}
#palvelut h2 {
margin-top: 15px;
}
#yhteysheader {
visibility: hidden;
}
.pored {
padding-left: 10px !important;
}
.veliki {
padding: 0px;
}
.veliki i {
}
#menu ul li {
width: 20%;
padding: 0;
}
.naslov{
margin-top: 210px !important;
}
i {
padding-left: 19px;
}
#menu #nav li a{
padding: 0;
}
}
#media only screen and (max-width: 991px) {
.slicica{
padding-left: 0 !important;
}
}
#media only screen and (max-width: 550px) {
#header {
display: none;
}
.mobile {
visibility: visible !important;
display: block !important;
background-color: #17331F;
color: white !important;
}
.mobile a {
text-decoration:none;
}
#palvelut h2 {
margin-top: 2px;
}
#wrapper{
top: 60px !important;
}
#menu ul li {
padding: 1px;
margin: auto;
}
#menu ul li a {
text-align: center;
font-size: 12px;
padding: 5px;
}
#menu ul li a i {
padding-left: 13px;
}
h2 {
font-size: 30px;
}
p {
font-size: 17px;
}
.forma {
font-size: 17px;
line-height: 10px;
}
.mapa {
height: 500px !important;
}
.veliki i {
padding-left: 0px !important;
}
.dugme{
}
footer{
bottom: 50px !important;
}
.video{
width: 100% !important;
left: 0% !important;
}
}
.video {
width: 60%;
left: 20%;
}
#content .page-text img {border:none;}
div#palvelut ul { /*list-style: none;*/ padding-left: 1em; }
div#footer { background: url(images/bisnesmuotoilulogo.png) bottom left no-repeat; padding-top:30px;margin-top:30px;border-top:1px dotted #ccc; height: 200px; }
.section {padding:30px 20px 20px 20px;text-align:left;}
.section p, .section ul, .section ol {line-height:20px;margin:0 0 20px 0;}
.section ul, .section ol {margin-left:20px;}
.section ul ul, .section ol ul, .section ul ol, .section ol ol {
/*margin:0 0 0 20px;*/
}
.section h2 {color:#BA0000;font-size:22px;font-family:arial;line-height:22px;letter-spacing:-1px;margin:0 0 15px 0;padding:0;}
.section h3 {color:#BA0000;font-family:arial;font-size:19px;margin:0 0 10px 0;}
.section h4 {color:#BA0000;font-family:arial;font-size:15px;margin:0 0 10px 0;}
.section h5 {color:#BA0000;font-family:arial;font-size:13px;margin:0 0 10px 0;}
.section h6 {color:#BA0000;font-family:arial;font-size:10px;margin:0 0 10px 0;}
.section blockquote {
margin:0 0 20px 20px;
line-height: 19px;
font-size:12px;
color:#666;
font-style:italic;
border-left:2px solid #ccc;
padding:0 0 0 15px;
}
.section code {border:1px solid #ececec;padding:2px;font-family: Consolas, Monaco, "Courier New", Courier, monospace;font-size: 12px;background:#f9f9f9;color:#000;}
.section pre code {line-height:17px;padding:15px;border:1px solid #ececec;font-family: Consolas, Monaco, "Courier New", Courier, monospace;font-size: 12px;background:#f9f9f9;color:#000;margin-bottom:22px;display:block;}
.credits {font-size:11px;text-transform:uppercase;color:#666;padding-top:15px;margin-top:30px;border-top:1px dotted #ccc;}
.credits p {margin:0 0 0 0;line-height:16px;padding:5px 0 0 0;}
.credits a:link, .credits a:visited {color:#666;}
.credits a:hover {color:#333}
footer {
overflow: hidden;
}</pre>
I would really appreciate the help in making this work. Thanks

Make sure to include the following:
Before closing body tag:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.3/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" type="text/javascript"></script>
In between your head tags, but before your custom styling:
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">

Related

Why wont my nav display dropdown-links vertically?

I have been sitting for 4 hours now trying to make my nav display dropdown-links vetically but it continues to show them horizontally instead. I can´t figure out why this is happening or how to fix it.
I would appreciate it very much if some kind soul could tell me what I am doing wrong. I have a sneaking suspecion this is caused due to my settings for the nav (it changes size at a certain width) but I am not sure...
I have ripped my nav from my website and thrown everything into codepen, but even after several attempts to figure out where the problem starts - nothing! It displays "link1" right below and then just adds "link2" and "link3" to the right of it, instead of under
Please help?
Codepen: https://codepen.io/Pinchofginger/pen/BJJQgZ
If there are any oddities in the CSS it´s because I have a dropdown menu for mobile that display when you press an icon... it is not currently working either, but that a question for another time.
My HTML
<header class="mainheader">
<section id="baggrund">
<div id="mainlogo">
Sønderborg
<p> og omegns</p> Kattelaug<br />
<img class="vector" src="billeder/udklip.png" alt="Kattesilhuet"></div>
<nav>
<input type="checkbox" id="menu-checkbox" role="button" />
<label for="menu-checkbox" id="menu-button">
<span class="bar"></span>
<span class="bar"></span>
<span class="bar"></span>
</label>
<div id="nav_wrap">
<ul id="menu">
<li>Forside</li>
<li>Adopter en kat</li>
<li>Tilløber katte</li>
<li> Kattens pleje</li>
<li class="dropdown">
<a href="javascript:void(0)" class="dropbtn">
Kontakt</a><div class="dropdown-content">
Link 1
Link 2
Link 3
</div>
</li>
</ul></div>
</nav>
</section>
</header>
MY CSS
/* small nav */
#media screen and (max-width: 61em) {
#menu li {
width: 20%;
}
#menu li a {
font-size: 0.9em;
width:100%;
color:red;}
#menu ul {width:100%;}
/*sidebar*/
body#index .sidemenu .sidebar1 {padding: 0 0 0 0;}
body#index #Mega {width: 96%; height:80px;}
body#index .sidemenu .sidebar1 h3 {font-size: 0.9em;}
}
/* stor nav*/
#media screen and (min-width: 61em) {
#menu li {
width: 20%;
}
#menu li a {
font-size: 1.2em;
width:100%;
color: #505050;
}} /*slut, stor*/
#menu li {
display: inline-block;
background: none;
padding: 5px 5px 5px 5px;
}
#menu li a {
text-transform: uppercase;
transition: all .5s ease;
text-decoration: none;
text-align: center;
line-height: 55px;
display: inline-block;}
.sidemenu .pleje {font-size: 0.9em; display:inline-block }
.sidemenu .pleje h3 {color: orange;}
#mainlogo {
display: block;
}
.mainheader {
width: 100%;
}
#bannerkat { display: none;}
#menu-button { display: none;}
#menu {
display: block;
border-radius: 0;
text-align: center;
position: relative;
}
/* Navigations menuen (links osv) */
#nav_wrap {
background: #f9f4ea;
width: 100%;
white-space: nowrap;
float: left;
height: 60px;
position: relative;
margin-top: 144px;
bottom: 0;
/* overflox:hidden; */
z-index: 9999;
opacity: .9;
box-shadow: 0px 1px 4px beige;
padding: 0;
}
li a, .dropbtn {
display: inline-block;
color: white;
text-align: center;
padding: 14px 16px;
text-decoration: none;
}
li a:hover, .dropdown:hover .dropbtn {
background-color: red;
}
li.dropdown {
display: inline-block;
}
.dropdown-content {
display: none;
position: absolute;
background-color: #f9f9f9;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
z-index: 1;
}
.dropdown-content a {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
text-align: left;
}
.dropdown-content a:hover {background-color: #f1f1f1}
.dropdown:hover .dropdown-content {
display: block;
}
/* højde for billed-sektion*/
.mainheader section {
min-height: 204px;
}
#mainlogo {
font-size: 37px;
color: white;
border: 7px solid white;
display: inline-block;
padding: 10px;
position: absolute;
height: 123px;
/* hvid boks*/
line-height: 25px;
top: 202px;
margin-top: -180px;
left: 50%;
width: 600px;
text-align: center;
margin-left: -300px;
text-shadow: 1px 2px 1px #000;
box-shadow: 1px 2px 1px #000;
}
/* og omegns */
#mainlogo p {
font-size: 20px;
padding: 5px;
}
.vector {
width: 60px;
margin-left: -450px;
margin-top: -36px;
}
.mainheader {
margin-top: 10px;
}
Change line 42 in css: "menu li a" to Display: block instead of Display: inline-block:
#menu li a {
text-transform: uppercase;
transition: all .5s ease;
text-decoration: none;
text-align: center;
line-height: 55px;
display: block;
}

Why isn't my nav class expanding to 100% of the width?

So I'm trying to understand why when I specify the width for my .thenav class it is not expanding to the entire width of the page.
I UNDERSTAND that it is taking the characteristics of the .container class, but I don't understand why and what is the solution seeing that i specified the width? PLEASE HELP!
Here is my picture of what's happening (I attached an image of what's happening because the jsfiddle makes the div appear at 100% and it's not):
http://imgur.com/a/zsBqC
Here is my jsfiddle:
https://jsfiddle.net/CheckLife/yox7Ln1b/3/
Here's the code for reference:
HTML:
<div class="header">
<div class="container">
<h1 id="box" onload="changed()"><image src="nbaone.png" width="40px" height="55px" class="nba">NBA Legends</h1>
<div class="thenav" onload="changed()">
<ul>
<li><a href="http://www.nba.com"/>Home</a></li>
<li onclick="changeP()">About</li>
<li>Players
<ul>
<li onmouseover="slow()"></li>
<li><a href="#kobesec"/>Kobe</a></li>
<li><a href="#"/>Kevin Durant</a></li>
<li><a href="#"/>The Goat</a></li>
</ul>
</li>
<li onclick="slow()">News</li>
</ul>
</div>
</div>
</div>
CSS:
* {
margin: 0;
padding: 0;
list-style-type: none;
text-decoration: none;
}
header, nav, section, aside, footer, article {
display: block;
}
body {
background-image: url(backwood.png);
width: 100%;
margin: auto;
}
.container {
margin: 0px auto;
background-size: cover;
width: 1300px;
height: 100%;
}
.header {
background:linear-gradient(to right, #5092f4, #f29641);
margin-top: 0px;
width: 100%;
}
.header h1{
text-align: center;
width: 100%;
padding-bottom: 15px;
font-family: Arial, Helvetica, sans-serif;
color: #f4ca1f;
}
.tmacw {
display:inline;
position: relative;
padding: 0px;
top: 5px;
}
.nba {
margin-right: 10px;
}
.thenav {
background-color: #7886a3;
width: 100%;
height: 85px;
position: relative;
z-index: 1;
}
/* Style for the Nav Bar */
.thenav ul {
padding: 0;
margin: 0;
}
.thenav ul li {
float: left;
width: 90px;
text-align: center;
border-right: 1px groove #141e38;
position: relative;
}
.thenav ul li a {
display: block;
color: white;
font-weight: bold;
padding: 33px 10px;
}
.thenav ul li a:hover {
background-color: #47e586;
transition: all 0.90s;
}
/*Dropdown Nav */
.thenav li ul li{
background-color: #7886a3;
border: 2px groove grey;
border-radius: 4px;
position: relative;
}
.thenav li ul li a {
padding: 8px;
text-align:left;
}
.thenav li ul li:nth-child(1) a:hover {
background-color: #F47575;
}
.thenav li ul li:nth-child(2) a:hover {
background-color: #f7d759 ;
}
.thenav li ul li a:hover{
background-color: red;
}
.thenav ul li ul {
display: none;
}
.thenav li:hover ul{
position:absolute;
}
.thenav li:hover ul{
display: block;
}
/* End of Dropdown */
.userlogin {
font-size: 12px;
top:2px;
color: white;
}
input[type=text], input[type=password] {
font-weight: bold;
margin: 0;
font-size: 8px;
height: 10px;
padding: 3px 5px 3px 5px;
color: 162354;
}
/* Stats Button */
.stat input[type=button] {
background-color: #6cd171;
color: blue;
border-radius: 6px;
font-weight: bold;
border: none;
float: left;
margin-top: 20px;
margin-left: 20px;
padding: 2px 2px;
font-family: Verdana, Geneva, sans-serif;
}
.log[type=button] {
background-color: white;
color: #008cff;
border-radius: 4px;
font-weight: bold;
border: none;
padding: 1px 2px 2px 2px;
position: relative;
left: 5px;
top: 3px;
}
A child div that does not have absolute positioning and has a width of 100% (unnecessary if it's display is the default of block) will be set to it's containers width. Your div.container has a width setting of 1300px and it is the parent element of div.thenav, therefore div.thenav's width will also be 1300px.
You can either remove width on the container:
.container {
margin: 0px auto;
background-size: cover;
/*width: 1300px; remove this */
height: 100%;
}
or:
Move div.thenav outside of div.container as in this code:
(https://jsfiddle.net/nod19rze/)
<div class="header">
<h1 id="box" onload="changed()"><image src="nbaone.png" width="40px" height="55px" class="nba">NBA Legends</h1>
<div class="thenav" onload="changed()">
<!-- contents of thenav here -->
</div>
<div class="container">
</div>
</div>
Either the container should be the first wrapper and then comes the header, which could solve the issue. I am not sure if this is what u need. Please check this fiddle:
https://jsfiddle.net/estgLn1q/1/
<div class="container">
<div class="header">
</div>
</div>
Or if you want to maintain the same html structure, then remove width:1300px from '.container' which will cause the container to take the same width as of its parent.
I would just move #box and .thenav out of .container and start that class after those elements.
* {
margin: 0;
padding: 0;
list-style-type: none;
text-decoration: none;
}
header,
nav,
section,
aside,
footer,
article {
display: block;
}
body {
background-image: url(backwood.png);
width: 100%;
margin: auto;
}
.container {
margin: 0px auto;
background-size: cover;
width: 1300px;
height: 100%;
}
.header {
background: linear-gradient(to right, #5092f4, #f29641);
margin-top: 0px;
width: 100%;
}
.header h1 {
text-align: center;
width: 100%;
padding-bottom: 15px;
font-family: Arial, Helvetica, sans-serif;
color: #f4ca1f;
}
.tmacw {
display: inline;
position: relative;
padding: 0px;
top: 5px;
}
.nba {
margin-right: 10px;
}
.thenav {
background-color: #7886a3;
width: 100%;
height: 85px;
position: relative;
z-index: 1;
}
/* Style for the Nav Bar */
.thenav ul {
padding: 0;
margin: 0;
}
.thenav ul li {
float: left;
width: 90px;
text-align: center;
border-right: 1px groove #141e38;
position: relative;
}
.thenav ul li a {
display: block;
color: white;
font-weight: bold;
padding: 33px 10px;
}
.thenav ul li a:hover {
background-color: #47e586;
transition: all 0.90s;
}
/*Dropdown Nav */
.thenav li ul li {
background-color: #7886a3;
border: 2px groove grey;
border-radius: 4px;
position: relative;
}
.thenav li ul li a {
padding: 8px;
text-align: left;
}
.thenav li ul li:nth-child(1) a:hover {
background-color: #F47575;
}
.thenav li ul li:nth-child(2) a:hover {
background-color: #f7d759;
}
.thenav li ul li a:hover {
background-color: red;
}
.thenav ul li ul {
display: none;
}
.thenav li:hover ul {
position: absolute;
}
.thenav li:hover ul {
display: block;
}
/* End of Dropdown */
.userlogin {
font-size: 12px;
top: 2px;
color: white;
}
input[type=text],
input[type=password] {
font-weight: bold;
margin: 0;
font-size: 8px;
height: 10px;
padding: 3px 5px 3px 5px;
color: 162354;
}
/* Stats Button */
.stat input[type=button] {
background-color: #6cd171;
color: blue;
border-radius: 6px;
font-weight: bold;
border: none;
float: left;
margin-top: 20px;
margin-left: 20px;
padding: 2px 2px;
font-family: Verdana, Geneva, sans-serif;
}
.log[type=button] {
background-color: white;
color: #008cff;
border-radius: 4px;
font-weight: bold;
border: none;
padding: 1px 2px 2px 2px;
position: relative;
left: 5px;
top: 3px;
<div class="header">
<h1 id="box" onload="changed()"><image src="nbaone.png" width="40px" height="55px" class="nba">NBA Legends</h1>
<div class="thenav" onload="changed()">
<ul>
<li><a href="http://www.nba.com" />Home</a>
</li>
<li onclick="changeP()">About</li>
<li>Players
<ul>
<li onmouseover="slow()">
</li>
<li><a href="#kobesec" />Kobe</a>
</li>
<li><a href="#" />Kevin Durant</a>
</li>
<li><a href="#" />The Goat</a>
</li>
</ul>
</li>
<li onclick="slow()">News</li>
</ul>
</div>
<div class="container">
</div>
</div>

Can't get the main links hover focus to stay

So my problem is that I can't get my navigation links focused. When you try to click the link the it doesn't stay focused so the dropdown box only gets displayed for a second.
This is the navigation I am trying to do.
*{
margin: 0px;
padding: 0px;
list-style-type: none;}
header,nav,article,section,footer,aside {
display: block;}
#container {
width: 100%;
margin: 0px auto;}
.nav-main {
width: 100%;
background-color: #222;
height: 70px;
color: #fff;}
.logo {
float: left;
height: 40px;
padding: 15px 30px;
font-size: 1.4em;
line-height:40px;}
.nav-main > ul {
float: left;}
.nav-main > ul > li {
float: left;}
.nav-item:hover {
background-color: #444;}
.nav-item {
color: #fff;
text-decoration: none;
display: inline-block;
padding: 15px;
height: 40px;
line-height: 40px;}
.sub-link {
text-decoration: none;
color: #fff;}
.nav-content {
position: absolute;
background-color: #444;
height: 200px;
max-height: 0px;
overflow: hidden;}
.nav-content-sub {
padding: 20px;}
.nav-content a:hover {
text-decoration: underline;}
.sub-link {
display: inline-block;
padding: 15px;
line-height: 10px;}
.nav-item:focus {
background-color: #444;}
.nav-item:focus ~ .nav-content {
max-height: 200px;}
<nav class="nav-main">
<div class="logo">Website</div>
<ul>
<li>
News
<div class="nav-content">
<div class="nav-content-sub">
<ul>
<li>Safsafasf</li>
<li>Safsasagsagasg</li>
<li>Qgagsag</li>
<li><a href="" class="sub-link">wKgagsagsagsgsagsaga<a></li>
</ul>
</div>
</div>
</li>
You forgot to give the News a direction (link to a website or page). If you don't want the news item link to a page use "#" instead of "" like so News
<!DOCTYPE html>
<html>
<head>
<style>
*{
margin: 0px;
padding: 0px;
list-style-type: none;}
header,nav,article,section,footer,aside {
display: block;}
#container {
width: 100%;
margin: 0px auto;}
.nav-main {
width: 100%;
background-color: #222;
height: 70px;
color: #fff;}
.logo {
float: left;
height: 40px;
padding: 15px 30px;
font-size: 1.4em;
line-height:40px;}
.nav-main > ul {
float: left;}
.nav-main > ul > li {
float: left;}
.nav-item:hover {
background-color: #444;}
.nav-item {
color: #fff;
text-decoration: none;
display: inline-block;
padding: 15px;
height: 40px;
line-height: 40px;}
.sub-link {
text-decoration: none;
color: #fff;}
.nav-content {
position: absolute;
background-color: #444;
height: 200px;
max-height: 0px;
overflow: hidden;}
.nav-content-sub {
padding: 20px;}
.nav-content a:hover {
text-decoration: underline;}
.sub-link {
display: inline-block;
padding: 15px;
line-height: 10px;}
.nav-item:focus {
background-color: #444;}
.nav-item:focus ~ .nav-content {
max-height: 200px;}
</style>
</head>
<body>
<nav class="nav-main">
<div class="logo">Website</div>
<ul>
<li>
News
<div class="nav-content">
<div class="nav-content-sub">
<ul>
<li>Safsafasf</li>
<li>Safsasagsagasg</li>
<li>Qgagsag</li>
<li><a href="" class="sub-link">wKgagsagsagsgsagsaga<a></li>
</ul>
</div>
</div>
</li>
</nav>
</body>
</html>

Vertical sub dropdown navi-bar menus

body {
margin: auto;
max-width: 98%;
overflow-y: scroll;
}
div {
border-radius: 5px;
}
span {
font-weight:bold;
}
#header {
position: absolute;
z-index: 1;
background-color: orange;
height: 70px;
width: 98%;
margin-top: -10px;
margin-bottom: 10px;
}
#name {
float:left;
margin-left: 400px;
margin-top: 10px;
padding-top: 1px;
font-size: 20px;
font-family: Verdana, sans-serif;
color: brown;
}
#contact {
position: absolute;
margin-left: 250px;
margin-top: 30px;
padding-top: -1px;
font-family: Verdana, sans-serif;
color: brown;
}
#email {
position: absolute;
margin-left: 360px;
margin-top: 45px;
padding-top: 1px;
font-size: 16px;
font-family: Verdana, sans-serif;
color: brown;
}
a:hover {
font-weight: bold;
}
a,visited {
color: black;
}
#nav {
position: relative;
background-color: brown;
float: left;
width: 11%;
height: 820px;
margin-top: 70px;
margin-bottom: 10px;
}
#nav_wrapper {
width: 900px;
margin: 0px auto;
text-align: left;
}
#nav ul {
list-style-type: none;
margin: 0px;
padding: 0px;
position: relative;
}
#nav ul li {
display: block;
}
#nav ul li:hover {
background-color: #333;
width: 219px;
}
#nav ul a,visited {
color: #ccc;
display: block;
padding: 15px;
text-decoration: none;
}
#nav ul a:hover {
color: #099;
text-decoration: none;
padding: auto;
}
#nav ul li:hover ul {
display: block;
width: 219px;
}
#nav ul ul {
display: none;
position: absolute;
}
#nav ul ul li {
display: block;
padding: 25.5px;
background-color: #222;
}
#nav ul ul li:hover {
color: #099;
width: 168px;
}
#nav ul ul li,visited {
color: #ccc;
}
ul .sub_navi {
display: none;
}
li:hover .sub_navi {
background: #999;
border: #fff solid;
border-width: 1px;
display: block;
position: absolute;
left: 220px;
top: 4px;
}
.right {
position: static;
background-color: linen;
float: right;
width: 88%;
height: 820px;
margin-top: 70px;
margin-bottom: 10px;
padding: 5px;
}
h4 {
margin-left: 5px;
margin-bottom: 15px;
font-family: Verdana, sans-serif;
text-decoration: underline;
}
.right p {
margin-left: 5px;
margin-right: 5px;
margin-top: -10px;
font-family: Garamond, serif;
color: #000000;
}
#company {
font-family: Garamond, serif;
}
#position {
font-style: italic
}
li {
list-style-type: square;
}
#footer {
height: 40px;
width: 100%;
background-color: orange;
position: relative;
clear: both;
}
<!DOCTYPE html>
<html>
<head>
<link type="text/css" rel="stylesheet" href="style.css"/>
<title></title>
</head>
<body>
<div id=header>
<p id="name">Henry jones</p>
</div>
<div id="nav">
<div id="nav_wrapper">
<ul>
<li>Home</li>
<li>About Me
<ul>
<li>Board Games
<ul class="sub_navi">
<li>Cosmic Encounter</li>
<li>Agricola</li>
<li>Trajan</li>
</ul>
</li>
<li>League of Legends</li>
<li>Sports</li>
</ul>
</li>
<li>Travels
<ul>
<li>Paris</li>
<li>Turks and Caicos</li>
<li>Puerto Rico</li>
<li>Chicago</li>
</ul>
</li>
</li>
<li>Resume</li>
<li>Contact
<ul>
<li>Phone</li>
<li>Email</li>
</ul>
</li>
</ul>
</div>
</div>
<div class="right">
<h4>Welcome</h4>
<p><img src="https://pbs.twimg.com/media/CAY3PIpXEAAkO75.png"></a>
</p>
I have created the drop down menu but I am having some trouble. Please help me with this html. The problem is when I hover my cursor next to the navi bar I, the navigation bar keeps "blinking". I would like some assistant on how to code this more efficiently. Also, where do i put display:none to make the board game sub navi disappear when highlight something else. Thank you.
Try to use width: 100%; for #nav_wrapper. This will solve the problem.
I finally fixed it!
nav ul li {display: block;}
changed to
nav ul li {Visibility: hidden;}
and
nav ul li:hover ul {display: block;width: 219px;}
changed to
nav ul li:hover > ul {Visibility: visible;width: 219px;}

Why are my social media icons huge?

I tried to add some social media icons to my header just now and they are about 10 times larger than they should be. I've gone through the css and used firebug and I can't find what is doing this.
I would like them to be their regular size and sit on the top right of the header. Thanks in advance!!
Here's what it looks like ( http://www.bolistylus.com ):
Here's the style.css:
a {
color: #254655;
}
ul, ol {
margin: 0 0 0 5.5em;
}
#page {
margin: 0 auto;
}
body{
background: #f3f3f3;
border-top: none;
border-top: 10px solid #666666;
}
#page {
margin: 0em auto;
width: 1000px;
}
.singular.page .hentry {
padding: 0.5em 0 0;
}
#branding{
background: #f3f3f3;
color: #000000;
border-top: none;
position: relative;
z-index: 2;
}
#site-title {
/*margin-right: 270px;*/
padding: 0.66em 0 0 0;
}
#site-title a {
color: #111111;
font-size: 60px;
font-weight: bold;
line-height: 36px;
text-decoration: none;
}
#branding h1, header#branding a{
text-align: left;
margin-right: 0;
}
#branding span{
text-align: center;
}
#branding img {
height: auto;
margin-bottom: -.66em;
width: 30%;
}
#branding .widget{
position: absolute;
top: 2em;
right: 7.6%;
}
#respond{ background: #E7DFD6; }
.welcome{
margin: 15px 60px;
background: #f3f3f3;
border: 1px solid #f6ff96;
padding: 15px;
text-align: center;
}
/* =Menu
-------------------------------------------------------------- */
/*.header_nav ul{
margin: 0;
padding: 0;
text-align: center;
width: 400px;
}
*/
#branding img .sm-img {
height: auto;
margin-bottom: -.66em;
width: 100%;
}
.header_nav {
background: #f3f3f3
}
.header_nav .head-nav {
border-bottom: 1px solid #cfcec9;
border-top: 1px solid #cfcec9;
margin-top: 30px;
padding-top: 5px;
padding-bottom: 5px;
text-align: right
}
.header_nav ul li{
display: inline;
}
.header_nav ul li a{
padding: 10.5px 21px;
color: #000000;
}
.header_nav ul li a:hover, .menu ul li .current{
color: #a8cb17;
text-decoration: none;
}
#access {
background: #f3f3f3; /* Show a solid color for older browsers */
}
#access ul {
font-size: 13px;
list-style: none;
margin: 0 0 0 -0.8125em;
padding-left: 0;
}
#access li {
float: center;
position: relative;
display: inline;
}
#access a {
}
#access ul ul {
}
#access ul ul ul {
}
#access ul ul a {
}
#access a:focus {
}
#access li:hover > a,
#access a:focus {
}
#access ul li:hover > ul {
}
#access .current_page_item > a,
#access .current_page_ancestor > a {
font-weight: bold;
}
You're specifying a percentage width multiple times in your CSS, here are the lines:
style.css (line 70)
#branding img {
height: auto;
margin-bottom: -0.66em;
width: 30%; //remove
}
style.css (line 530)
#branding img {
height: auto;
margin-bottom: -7px;
width: 100%; //remove
}
Remove those and they should display ok.
Try to change your css here:
#branding img {
height: auto;
margin-bottom: -0.66em;
width: 3%; /* 3 not 30 */
}
In style.css line 70
Line 70 of your style.css is setting a width attribute with a value of 30%. This is causing your images to stretch to 30% of their container.
#branding img {
height: auto;
margin-bottom: -.66em;
width: 30%;
}
Adjust the width to a lower percentage or remove the line entirely.