Is it allowed to have a line break inside a html tag? For example:
<h1
id="heading">
A first test in Chrome shows that this works, but is it specifically allowed by the spec and do all browsers (especially email clients) parse this correctly?
And what about in attributes?
<h1
class="one
two">
In this case, will it be interpreted as a space?
(This last case is not answered in the "possible duplicate question")
The <br> HTML element produces a line break in text (carriage-return).
You can insert line breaks in HTML with the <br> tag, which is equivalent to a carriage return on a keyboard. Be aware that HTML will ignore any line break from a keyboard's return key. If you are wondering why there's a forward slash in the <br> tag above, the slash was important when HTML4 was still widely used.
To add a line break to your HTML code, you use the <br> tag. The <br> tag does not have an end tag. You can also add additional lines between paragraphs by using the <br> tags. Each <br> tag you enter creates another blank line.
The HTML <br> tag is used for representing a line break. The <br> tag is an empty tag. In other words, it has no end tag (i.e. only use the opening tag <br> ).
yes that is acceptable! The browser will ignore line breaks and will teat them as spaces. So in you second example you will have an h1
element with two classes as attributes.
So
<h1
class="one
two">
is the same as
< h1 class="one two">
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With