Cian Woods
Cian Woods

Reputation: 47

How do I use line-height correctly?

I made a navigation menu 100% width fixed to the top of the page.

#nav {

height: 50px;

}

I've used line-height to put text in center of the nav before but it's not working when I do this..

#nav ul li a {

line-height: 50px;
 }

It is appearing half way off the bottom of the nav

Upvotes: 1

Views: 68

Answers (1)

Mohd Abdul Mujib
Mohd Abdul Mujib

Reputation: 13948

OK, You seem to have missed the fact that browsers have some inbuilt styles for the elements like <ul> etc.

And that margin for the <ul> is pushing the whole menu down.

Try "normalizing" your css by including

ul {
    margin: 0px;
}

As shown HERE.

Upvotes: 2

Related Questions