CSS CSS Layout Basics Controlling Layout with CSS Display Modes Using Inline-Block to Set Width, Height, Top and Bottom Margin and Padding

Jesse Dispoto
Jesse Dispoto
Front End Web Development Techdegree Graduate 14,537 Points

Can't we just edit the html and nest the <li> tag within the <a> tag, to achieve the same thing?

Gil has the <li> element followed by the <a> tag, you can just put the <li> element within the <a> and you will get the same effect as changing the display property

1 Answer

Eric M
Eric M
11,493 Points

Hi Jesse,

You're right that the behaviour of the link areas would be similar in both cases. When HTML, CSS, and JavaScript combine there's often a number of different ways to achieve the same result. It's great you're able to see the similarities in site behaviour to other techniques.

In this video Gil is illustrating some different aspects of the inline-block display setting. It might not always be the tool that you reach for but it's good to know what it can do.

Cheers,

Eric