Tip:
Highlight text to annotate it
X
One last thing I'd like to talk about with and --
I'll show you right now.
Let's make this all be one line again.
Okay--so I Update this and we have one line.
We can put a tag in the middle of this.
We don't actually have to have the line breaks in our HTML.
So when I click Update, we get our line break--
no matter how the HTML is formatted.
So we can format this however we want--
put all these spaces in here--
and when we Update this,
it'll always come out the same.
There's an example--all this Whitespace turns into one single space.
All of these new lines here turn into one single space.
You know--this text, space, is really--you know--you get the idea. Okay.
Why do we have two different ways of making new lines?
Why do we have a tag and a >p> tag?
The answer is because the tag is what we call "inline",
and the tag is what we call "block".
Now--so what the tag was actually doing
was just ending a line.
So when we have some text and we put a in the middle of it,
it just basically says: the line ends here,
and this guy wraps to the next line.
The tag works differently; the tag
actually makes an invisible box.
So when we have an HTML that looks like this--
this creates an actual box.
So instead of just rendering text, blank line--
what this is actually rendering is something sort of like this:
You've got two lines of text, and there's actually this invisible box around text.
And that's what the tag does,
is it makes this invisible box and this invisible box
can actually have height and it can have width--
where inline elements are just text.
So the example over here would be more like this:
so it's just two lines of text, and there's really just a little new line here.
There's nothing fancy going on.
And the difference between inline and block elements
will come up a fair amount later in this course.
And it's just important to know that there's a distinction
and they have kind of different behavior.
So far, all of the elements we've learned--other than --
are inline elements.
So inline elements are: , --
even is an inline element.
And we saw how, before, our little image
appeared right in the middle of the text.
That's because it's inline.
So far, the only block element we've learned is the element.