Search code examples
htmlcssinlineblock

CSS, display property(menuBar)


I am trying to understand html/css menu bar and my problem is at the display property,

I do know about this property very well, but if you take a look at this Link, just a simple menubar, but the problem is that i dont understand why does the li tag and the a tag at the css style include display property inside them when the float do the job and you can delete them and the menu looks the same, i know that there is a resone for thoes display properies to be there at thoes both tags styles but i dont get it, if can some one please help me understand why the display property with the value of inline at the li css style, and with value of block at the li a at the css style, and again its not that i dont know about this property it just i dont understand why its there, thank you all and have a nice day.


Solution

  • display:inline used in li's is to make li aligned Horizontal or side by side.

    display:block is used in li a so the a should take the complete with of the li so that if you click anywhere inside li the <a> tag will work & will not only work on clicking on the text.