I am currently making a website, and I would like to know if there is ever a space after <. By this I mean is there anything like < html> or is there no such thing as a "command" that has a space after <?

  • 1
    The terminology you are looking for is "HTML Elements" that are formed by "start tags" and "end tags". Specifically, you are asking where an "HTML start tag" can have a space after the opening less than symbol. Mar 21, 2020 at 22:51
  • Perhaps you want <html > instead. (where a newline can be used as well)
    – Joshua
    Mar 22, 2020 at 15:41
  • 1
    @StephenOstermiller: An element does not necessarily need to have tags. E.g. the head element is implied, even if there are no <head>/</head> tags. Also, there are empty elements, which only have one tag instead of a start and an end tag. And end tags can be implied. And that's just HTML5. Older versions of HTML were based on SGML which has such fun stuff as Null End Tags as well, e.g. in HTML 1.0–4.01, <span/Hello/ is equivalent to <span>Hello</span>. See softwareengineering.stackexchange.com/a/116483/1352 for an extreme example I concocted. Mar 22, 2020 at 15:51
  • Why do you want to include a space in that position? Why do you ask?
    – gnicko
    Mar 24, 2020 at 19:15

2 Answers 2


By this I mean is there anything like < html> or is there no such thing as a "command" that has a space after <?

No, you cannot have a space immediately after the < (less-than sign) in an HTML element's opening start tag.

From the HTML spec:

Start tags must have the following format:

  1. The first character of a start tag must be a U+003C LESS-THAN SIGN character (<).
  2. The next few characters of a start tag must be the element's tag name.
  3. :

There is no room for a space in there.

If you try this in a browser then it will likely output the malformed opening start tag as literal text. For example:

<p>Foo < b>bar</b> baz</p>

...is output in the browser as:

Foo < b>bar baz

  • That quote is not enough to answer the question. By the rules you defined, ! wouldn't be valid either, but we all know that <!-- is a valid comment opening tag, or that <!DOCTYPE is a valid doctype opening tag and maybe less people know that even <? will actually fallback to the bogus comment state.
    – Kaiido
    Mar 23, 2020 at 1:43
  • 2
    There are actual parser instructions in the HTML spec nowadays: html.spec.whatwg.org/multipage/parsing.html#tag-open-state But the principle of the answer remains the same.
    – Boldewyn
    Mar 23, 2020 at 8:11

No. There is not normally a space between the "<" and following characters. The HTML tag will not be parsed correctly by browsers and it appears that a space in that position is not allowed in the HTML standards.

  • 2
    What does this add that isn't already covered by the existing answer? If you agree with an existing answer then why not show your support and upvote it, rather than writing a similar (but arguably inferior) answer?
    – MrWhite
    Mar 24, 2020 at 22:41
  • What does your comment contribute to the question and the community as a whole? Or was it designed to just give you a chance to downvote and be a critical voice in a conversation that you otherwise chose to not participate? The other answer goes off on unnecessary tangents. The HTML specification cited does not fully cover the situation and is not helpful.
    – gnicko
    Mar 25, 2020 at 14:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.