Reputation: 57
during my time learning HTML on my own I noticed that I can "merge" certain tags and still have the same output. I say certain because I stumbled across a situation when something else happened. When I merged several line break tags versus when all the tags were independent of each other:
<br:br:br> != <br><br><br>
I struggle to recreate this. So I will explain as best as I can. I have a string of text output above an image, with line break tags to create spacing between the image and the paragraph. However, In the case of the "merged" tag, the paragraph moved from above the image, to next to the image.
Why? What is the difference between these two things? Am I even "merging" them to begin with?
I appreciate any explanation of this as I couldn't find anything online about this.
Upvotes: 0
Views: 364
Reputation: 550
Merging tags is not valid nor necessary. In your example using multiple
is excessive and creates too much content within your HTML when you can easily just do the same and more within your CSS.
Upvotes: 1
Reputation: 502
HTML tags must be opened and closed with the exception of self-closing tags. This is a core concept of HTML that is worth understanding. You can read about this here: https://www.w3schools.com/html/html_elements.asp
Upvotes: 0
Reputation: 944530
<br:br:br>
is invalid HTML. It is nonsense. (<br:br>
would be a br
element from the namespace assigned to the shorthand br
, which still wouldn't have a place in an HTML document)
<br><br><br>
is three sequential line breaks, which makes more sense, but not much more. It is a good sign that you should be using a CSS margin instead.
Upvotes: 3