- This topic is empty.
Viewing 6 posts - 1 through 6 (of 6 total)
Viewing 6 posts - 1 through 6 (of 6 total)
- The forum ‘Other’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
So I understand that the following code inside
tag will display without the breaks BUT with spaces?
Pellentesque habitant morbi tristique
senectus et netus et malesuada fames
ac turpis egestas.
will display:
“Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.”
My question: WHY? The reason I ask is how do I know when a space does or does not exist between text (say that was c & p) and now seperated in code.
For my own research — I looked at http://www.w3.org/TR/html5-author/the-p-element.html /// then here w3school /// then looked at different interpretation of w3.org here and here ///
thanks.
Casey
Why would you need to know if an html line break or space exists? Is there something specific you’re having a problem with or is this just a general question?
The
element defines a paragraph. Although spaces between words are displayed as usual, a line break within the
element code is only displayed as a space.
Not sure why you need to know “why”, this is standard
behavior…..?
When the code is rendered, white space is ignored. To actually create a line break you need to manually do it with < br >.
That is to do with how the white space is handled (as mentioned by @TheDoc). If you want to understand that a bit more (and control that behaviour) read this: http://www.w3.org/wiki/CSS/Properties/white-space
And this covers browser support: https://developer.mozilla.org/en/CSS/white-space
@Joshuanhibbert — THXS