How to align navbar li with vertical align?

C Sinke
<!DOCTYPE html>
<html lang="en">
<head>
<title>De Studiehoek</title>
<LINK HREF="style/main.css" REL="stylesheet" TYPE="text/css">
<script src="/Javascript/jquery-latest.js"></script>
<script type="text/javascript">
$(document).on("scroll",function(){
if($(document).scrollTop()>50){
    $("header").removeClass("large").addClass("small");
} else{
    $("header").removeClass("small").addClass("large");
}
});
</script>

</head>
<body>
<header  class=“large”>
<nav id="navbar">
<ul>
    <li><a href="#">Welkom</a></li>
    <li><a href="#">Informatie</a></li>
    <li><a href="#">Begeleiding</a></li>
    <li><a href="#">Visie</a></li>
    <li><a href="#">Contact</a></li>
</ul>
</nav> <!--navbar-->
</header>


<section id="welkom">

<p> test tekst </p>
<p> en nog meer tekst <p> 
</section>

</body>
</html>

body { 
background-color: #0d1416;
}


header,nav, a, img, li{
transition: all 1s;
-moz-transition: all 1s; /* Firefox 4 */
-webkit-transition: all 1s; /* Safari and Chrome */
-o-transition: all 1s; /* Opera */
}

/*header*/
header {
background: #FFFFFF;
opacity: 0.9;
float: left;
width: 100%;
position: fixed;
z-index: 10;
}

header.a { 
color: #969696;
text-transform: uppercase;
letter-spacing: 2px;
font-size: 1em;
} 

header a.active{
color: #3d3d3d;
} 
header a.hover{ 
color: #FF00FF;
}

/* Sizes for the bigger menu */
header.large{
top: 0;
left: 0;
height: 120px; 
}

header.large ul{
float: right;
}

header.large li{ 
display: inline;
text-transform: uppercase;
letter-spacing: 2px;
padding-right: 10px;
text-decoration: none;
}

header.large a{ 
text-decoration: none;
}

/* Sizes for the smaller menu */
header.small{
top: 0;
left: 0;
height: 50px; 
}

header.small ul{ 
float: right;
}


header.small li{ 
display: inline;
float: left;
text-transform: uppercase;
letter-spacing: 2px;
padding-right: 10px;
text-decoration: none;
}

header.small a{ 
text-decoration: none;
}

/*section welkom*/
#welkom {
float:left;
height: 1500px;
width: 100%;
position: relative;
} 

I'm working on a project, but i'm stuck with a problem. My navbar had a changing size, I want the <li> to vertical-align: middle; but I don't know how to get it to work. Can someone help me out here? I tried to make it work by putting it in the <li> and I tried to place the text in a different class and than tried to make it vertical align, but neither worked.

Ainz-sama

modify your code like this

header.large{
top: 0;
left: 0;
height: 120px;
margin: 0 auto;
display: table; //imporatnt use this on your header.small also
}

#navbar{
display:table-cell;
vertical-align: middle;
 }

this should work

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to vertical align bottom

From Dev

How to align the elements in the navbar?

From Dev

vertical-align within an <li> tag

From Dev

css vertical align img and text (multiline) in <li>

From Dev

Vertical Align images inside li Chrome Issue

From Dev

Center-align <li> in vertical <ul>

From Dev

css vertical align img and text (multiline) in <li>

From Java

How to Vertical align elements in a div?

From Dev

How to vertical align images and texts

From Dev

How to align linearlayout to vertical center?

From Dev

How to align vertical text in a table?

From Dev

How to vertical align this span element?

From Dev

How to align navbar to center with css

From Dev

How to align specific item into a <li>

From Dev

How to align text with ul & li

From Dev

How to customize bootstrap fixed navbar-default so that li elements align downward?

From Dev

Vertical-align play button with mobile navbar-button

From Dev

Vertical align logo inside .navbar-brand with Bootstrap 3

From Dev

Vertical align font awesome icon with text within <li>

From Dev

How to vertical-align label and select?

From Dev

How to vertical align text next to image

From Dev

How to do a best fit vertical align

From Dev

How to vertical align links in a div that contains an image?

From Dev

How to vertical align (center) the content of UITableView?

From Dev

How to vertical align my tag in my case

From Dev

How to vertical align links in a div that contains an image?

From Dev

How to vertical align (center) the content of UITableView?

From Dev

How to vertical align <a> inside list with variable height?

From Dev

How to set vertical align to middle in my case?

Related Related

HotTag

Archive