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

  • Home
  • SEARCH
  • 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 6384157
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T02:44:25+00:00 2026-05-25T02:44:25+00:00

When is it appropriate to use a closing tag and when a slash is

  • 0

When is it appropriate to use a closing tag and when a slash is enough?

<div></div>

vs.

<div />
  • 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-05-25T02:44:25+00:00Added an answer on May 25, 2026 at 2:44 am

    You can only use a self closing tag <div /> if your DOCTYPE is set to XHTML as this is borrowed from XML where you can have self closing tags. You can’t have it if your DOCTYPE is set to HTML 4.01 or HTML 5.

    http://www.w3.org/TR/xhtml1/

    I’m not sure your exact use case for wanting this, but if it’s for clearing floats, you can do this instead and not have to worry about compatibility issues, especially with IE if it kicks into emulation mode.

    <style type="text/css">
    .clear-fix {
        clear: both !important;
        display: block !important;
        font-size: 0 !important;
        line-height: 0 !important;
        border: none !important;
        padding: 0 !important;
        margin: 0 !important;
        list-style: none !important;
    }
    </style>
    <br class="clear-fix" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let's collect some tips for evaluating the appropriate use of global.asax.
When is it appropriate to use an unsigned variable over a signed one? What
When is it appropriate to use <cflock scope=application> or it's ilk as opposed to
When is it appropriate to use CoTaskMemAlloc? Can someone give an example?
When is it appropriate to use openGl-es on the iPhone versus other toolkits? I
When is it appropriate to use connection pooling and what happens when the maximum
I often find it confusing as to when it is appropriate to use: rs.Close
It's possible, but is it appropriate to use SHFileOperation within a Windows service? All
How are file descriptors and file pointers related? When is it appropriate to use
The short form of this question: When, if ever, is it appropriate to use

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.