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 571345
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T13:29:50+00:00 2026-05-13T13:29:50+00:00

I was testing this, since I understood using XHTML let me use any valid

  • 0

I was testing this, since I understood using XHTML let me use any valid XML for empty <div> elements:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title>Test</title>
</head>

<body>
<div style="border:solid 10px black; width:100px; height:100px"></div>
<div style="border:solid 10px red; width:100px; height:100px"></div>
<div style="border:solid 10px blue; width:100px; height:100px"></div>

<div style="border:solid 10px black; width:100px; height:100px" />
<div style="border:solid 10px red; width:100px; height:100px" />
<div style="border:solid 10px blue; width:100px; height:100px" />
</body>
</html>

It doesn’t work in any browser I try… this is how FireBug tells me it understands the document:

<html>
<head>
<meta content="text/html;charset=utf-8" http-equiv="Content-Type"/>
<title>Test</title>
</head>
<body>
<div style="border: 10px solid black; width: 100px; height: 100px;"/>
<div style="border: 10px solid red; width: 100px; height: 100px;"/>
<div style="border: 10px solid blue; width: 100px; height: 100px;"/>
<div style="border: 10px solid black; width: 100px; height: 100px;">
 <div style="border: 10px solid red; width: 100px; height: 100px;">
  <div style="border: 10px solid blue; width: 100px; height: 100px;"/>
 </div>
</div>
</body>
</html>

I’m a bit confused what the point is of using XHTML if I have to do this, I might as well just use HTML?

Note, that setting the content type to content=”application/xhtml+xml” makes no difference in FF3 at least.

  • 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-13T13:29:51+00:00Added an answer on May 13, 2026 at 1:29 pm

    To answer the question, the XHTML specification only allows ten different tags to have empty elements. As far as I know, the reason for this is to mostly be HTML compatible.

    For the sake of documentation, the valid tags are (from here):

    • <base />
    • <meta />
    • <link />
    • <hr />
    • <br />
    • <img />
    • <area />
    • <input />
    • <col />

    But your code isn’t actually be interpreted as XML anyway, you have a Content-Type: text/html. That tells the browser to interpret your code as normal HTML. To tell the browser to interpret your XHTML as XML you must send the content as application/xhtml+xml instead. There are other problems with this, though.

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

Sidebar

Related Questions

so i'm testing this so i can use it on my bigger project. I
I'm testing this out in LINQPad with the CRM plugin. What should my query
I am testing this sample on version 13 of android (3.2) and I have
I am testing this simple code below and it works... $(document).ready( function() { $('.show-modal').click(
I'm wondering how to go about testing this. I have a method that takes
I've written a mapping application which uses GPS. Testing this on my phone (a
IOW, is there a standard way of testing for this, a la: if (!
I've spent a lot of time googling this and testing in my program, but
I have written this regexp: <(a*)\b[^>]*>.*?</\1> and is tested on this regexp testing site:
Will this work for testing whether a value at position index exists or not,

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.