Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Nicholas Gabriel](https://uploads.teamtreehouse.com/production/profile-photos/7384442/micro_415FA70E-5161-4E65-9798-8B00873539E8.jpg)
Nicholas Gabriel
16,294 PointsOn set display property of <a> to block, inside a li element, which is inline-block. Why didnt <a> start with new line.
<li style="display:inline-block"><a href="#">ice cream</a></li>
<li style="display:inline-block"><a style="display:block" href="#">donuts</a></li>
<li style="display:inline-block"><a href="#">tea</a></li>
<li style="display:inline-block"><a href="#">coffee</a></li>
Here why donuts didnt start with new line as its block element now ???
3 Answers
![Steven Parker](https://uploads.teamtreehouse.com/production/profile-photos/969492/micro_tool_chess_set_2.jpg)
Steven Parker
230,688 PointsThat's what the "inline" part of "inline-block" means. It allows the element to share a line with it's neighbors.
A plain "block" element (which is the default for list items) would take up a whole line.
![furkan](https://secure.gravatar.com/avatar/950470aa294c72f55ea3a43ff64ab3a8?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
furkan
11,733 PointsThe <a> is a child ofits parent <li> so it will only take up the full width of its parent container.
However, if you set <li> to inline the <a> will technically too line up side by side, this is because it is contained in its parent <li>.
I hope that made sense.
![Nicholas Gabriel](https://uploads.teamtreehouse.com/production/profile-photos/7384442/micro_415FA70E-5161-4E65-9798-8B00873539E8.jpg)
Nicholas Gabriel
16,294 PointsYes. Thanks for answering.
![Nicholas Gabriel](https://uploads.teamtreehouse.com/production/profile-photos/7384442/micro_415FA70E-5161-4E65-9798-8B00873539E8.jpg)
Nicholas Gabriel
16,294 PointsOne more finding. If i will add some text before the "donuts" anchor tag, let say, "test". The donuts part start with a new line after "test". Here "test" is the first content in parent element. But in the earlier case "donuts" was the first content.
<li style="display:inline-block"><a href="#">ice cream</a></li>
<li style="display:inline-block">test<a style="display:block" href="#">donuts</a></li>
<li style="display:inline-block"><a href="#">tea</a></li>
<li style="display:inline-block"><a href="#">coffee</a></li>
![furkan](https://secure.gravatar.com/avatar/950470aa294c72f55ea3a43ff64ab3a8?s=60&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
furkan
11,733 PointsIt may be because you forgot to put a closing </li> after your test. Try this:
<li style="display:inline-block"><a href="#" style="display: block">ice cream</a></li>
<li style="display:inline-block"><a style="display:block" href="#">test</a></li>
<li style="display:inline-block"><a style="display:block" href="#">donuts</a></li>
<li style="display:inline-block"><a href="#" style="display: block">tea</a></li>
<li style="display:inline-block"><a href="#" style="display: block">coffee</a></li>
Nicholas Gabriel
16,294 PointsNicholas Gabriel
16,294 PointsYes, that I got. But what about the display style of anchor element corresponding to "donuts". Its set as "block"
Steven Parker
230,688 PointsSteven Parker
230,688 PointsInside a containing element, it will take up a line relative to other content in the same container. It won't affect the alignment of the container itself.