Why is display: block; on the links? tag "a", to make the navigation bar?

Asked

Viewed 45 times

-2

ul li a{ display: block; } 

Why do you need to put the links with display block when making the menus?

  • This attribute is not required, you can add a ul li to without the display block.

  • You don’t have to....

1 answer

1

In this case you don’t need it. The list tag already has the display: block; by default saved me mistake. In the case of block is not required unless you want in some way a vertical menu I think.

The difference would be by li{ display: inline;}, because you will change the layout of the list items so that they are next to each other(horizontal).

I think that’s it. Anyway, I hope I helped.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.