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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T21:24:41+00:00 2026-05-27T21:24:41+00:00

I am trying to follow the xhtml 1.0 strict standard as I am creating

  • 0

I am trying to follow the xhtml 1.0 strict standard as I am creating my website.
Right now, validator.w3.org validates my document as valid, following the XHTML 1.0 Strict standard. Here is a code-example:

<div style="color:#f00"><div style="color:#00f" />Text should be red and not blue</div>

Unfortunately, Firefox, Chrome and Internet Explorer parses the document incorrectly:
They all seem to ignore the closing statement of my self-closing tags (mostly <div />, <li /> and some other tags), thus rendering the site incorrectly, with the text being blue. if i replace <div /> tags with <div></div>, it all looks fine. I read about it and according to xml document, including xhtml, can be self-closed

Here is the important header information that comes with the document:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
        <head>
            <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />

Apache2 itself still sends Content-Type text/html, as I haven’t figured out yet how to overwrite the .php mime type, though the info in <head> should overrule that either way.

How can I use self-closing tags such as <div /> with them being parsed correctly by common browsers?

  • 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-27T21:24:42+00:00Added an answer on May 27, 2026 at 9:24 pm

    XHTML is HTML using XML and HTML does not have self-closing tags like you show. This works in XHTML but not HTML and, so far, you are not serving as application/xml+xhtml.

    The content-type meta tag does not affect how the server serves the page and is for offline use only. So you must either set it in the server or with PHP, in your case.

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

Sidebar

Related Questions

I'm trying to follow these docs: http://readthedocs.org/docs/neo4j-rest-client/en/latest/indices.html This works fine from neo4jrestclient.client import GraphDatabase,
Trying to follow this tutorial Walkthrough: Part 1 - Creating a Basic Project System
I'm trying to follow Michael Hartl's Ruby on Rails Tutorial in http://ruby.railstutorial.org/chapters/sign-in-sign-out , but
I'm trying to follow the @BalusC advice here . (I'm writing here now because
I'm trying to write a SAX parser for an XHTML document that I download
I'm trying to follow along with http://mongotips.com/b/array-keys-allow-for-modeling-simplicity/ I have a Story document and a
I'm trying to follow a tutorial on Tapestry. (http://tapestry.apache.org/tapestry5.1/tutorial1/env.html) The tutorial recommends Jetty 5.1
I'm trying to follow THE magnificient Rails3 tutorial at http://railstutorial.org but ran into a
Trying to follow a technique found at bzr and gitosis I did the following:
Trying to follow this example. (Section String sorting...) Is there anything obvious that would

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.