Welcome to the Treehouse Community
Looking to learn something new?
Jonathan Buford2,065 Points
Why does adding display: block; padding: 10px 15px; result in moving the name and link to center?
Wow. I really feel like I should know this. I usually make things harder than they are but I've been on this for 3 days and have just started reverse engineering Guil's code in the zip file so I could at least learn something. Not knowing where to start and then having questions turn into more questions...I've been studying CSS and HTML for 9 months now and it has me worried;( These items were already showing on their own line before display: block.
Ugh. I feel like even my questions are not good, but I need you guys!
Padding and Display properties are two different aspects so I dont think must be centering an object, https://www.w3schools.com/cssref/playit.asp?filename=playcss_display&preval=block follow this link to know more about DISPLAY.
The padding doesn't necessarily have anything to do with it; it's the "display: block;"
Jesse Sandate985 Points
yeah exactly... The display property with a value of block makes the a-tags, which are normally inline elements, into block size. Thats why each link's hover area is the entire width of the viewport, essentially that is what is centering the text in the menu.