Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9202933
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T23:21:58+00:00 2026-06-17T23:21:58+00:00

I am learning HTML5, i want to know why these elements are closed differently

  • 0

I am learning HTML5, i want to know why these elements are closed differently the first input ends with > and the second ends with /> what difference does it make?

<input name = "howtosite" type = "radio"
              value = "search engine" checked> 

<input type = "color" autofocus /> 
              (Hexadecimal code such as #ADD8E6)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T23:21:59+00:00Added an answer on June 17, 2026 at 11:21 pm

    Briefly, some terminology: Confusingly, “HTML” now means two things:

    • The definition of the various kinds of elements that make up what we use in web pages and such. This is what tells us that there is an element called div and what it’s for.
    • One of the two serializations of it (the written form), which tells us we write div elements like this: <div>content</div>.

    The other serialization of HTML is XHTML. The two serializations differ in places, because XHTML is XML.

    HTML defines some elements that never have content, like <br>, and in the HTML serialization they’re usually written just like that, <br>. In the XHTML serialization that’s a problem, because XML requires that all tags be closed and <br> is just a start tag. Putting the slash (“solidus”) just before the ending > closes the tag, so in XHTML, <br> becomes <br/>. The / is tolerated in the HTML serialization, but it serves no purpose. It only serves a purpose in XHTML. (Note that in really, really old browsers, you may need a space before the solidus, e.g. <br />, but we’re talking very old indeed.)

    This is only true for void elements like <br> and <input> that never have any content, and foreign elements (MathML and SVG). You never write <div/>, for instance, even if the div is going to be empty. The correct form of an empty div is always <div></div> (whether in the HTML or XHTML serialization).

    Full detail in the specification, and in particular §8.1.2.1.

    So regarding your two specific examples: The first is only valid in the HTML serialization. The second is also valid in the HTML serialization, and would be valid in the XHTML serialization if the autofocus attribute had a value (in XML, attributes must have a value, so you have to write autofocus="autofocus").

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am learning about HTML5 these days. Here comes trouble when I want to
I want to learn how to make a website with C#. I know PHP,
I want to make a tech news website. I started learning PHP, and since
I'm in the process of learning HTML5 (and OO Javascript) and am trying to
I've been learning a lot about web technologies recently and I want to put
I have a question. I'll post the HTML first, I know you shouldn't use
I want it to be as simple as this, but I know it isn't:
I want to start learning Sencha Touch. Being a server side programmer in Java
I want to learn server-side scripting. Since I know some Python, probably that would
I want to be able to create web front-ends to my Perl programs. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.