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 trialLoren Cardella
Python Web Development Techdegree Student 8,096 PointsWhat usually happens between elements displayed inline or inline-block?
I got this question wrong three times in a row. What is the answer and why?
3 Answers
Christian Andersson
8,712 PointsThe correct answer is the one about line-breaks and tabs.
Basically, with inline and inline-block elements, if there is a new-line, a space or a tab between the tags are actually applied in the document - and are not removed. This happens for the same reason a regular space between words works.
Look at this demo: https://jsfiddle.net/mn4z39ss/1/
The first 2 boxes are coded as:
<span></span>
<span></span>
So 2 spans, each on a new line.
However if there is no new-line/space/tab there isn't any space! Did you notice how the same exact code worked for the bottom 2 boxes that were on ONE line?
<span></span><span></span>
This is can sometimes be frustrating because you typically use new-lines as a way to indent your code so that it looks organized and easy to read.
Loren Cardella
Python Web Development Techdegree Student 8,096 PointsThank you; I appreciate the completeness of that answer.
Christian Andersson
8,712 PointsGlad I could help.
Kathryn Notson
25,941 PointsLoren Cardella:
Here's a link on inline & inline block elements: http://www.w3schools.com/htmL/html_blocks.asp.