Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

xhtml-strict?

If you are not using css to format a simple webpage, how can you align something? I have tried to use align="center" but it is not valid to xhtml-strict???

5 Answers

Relevance
  • 1 decade ago
    Favorite Answer

    Change the "!DOCTYPE" at the top of the HTML to the html/xhtml transitional or loose. You could find the !DOCTYPE you could copy and paste into your HTML on the internet by searching.

    You have !DOCTYPE strict at the top of your HTML, which enforces strict rules and it must meet standards. That is why it is strict. If you don't want to meet the standards exactly don't use strict, but use transitional or loose !DOCTYPE.

    Using style="text-align: center" with the "div" or "p" is allowed under the xhtml strict standard. This is your only option if you want to use xhtml strict.

    The answer to your question is that you MUST use CSS or the style artribute (which is considered CSS) if you are using xhtml strict. You can't use align="center", this goes against the standard. There is NO other way to do it. The other option is don't use xhtml strict if you want to use align="center".

    Edit: Enter the following xhtml at http://validator.w3.org/#validate_by_input

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "ht tp://www. w3.org/ TR/xhtml1/ DTD/xhtml1-strict.dtd">

    <!-- IMPORTANT: remove 4 spaces in above URL -->

    <!-- yahoo answers clips it without spaces -->

    <!-- delete these comments after this is done -->

    <html xmlns="http://www.w3.org/1999/xhtml%22%3E

    <head>

    <title>Validation Test</title>

    </head>

    <body>

    <div>

    <p style="text-align: center">Validation Test</p>

    </div>

    </body>

    </html>

    This confirms that inline styles can be used with xhtml strict.

  • 1 decade ago

    HTML (and XHTML) is a language designed to describe the semantics of content, not its appearance.

    The browser wars saw various presentational features added to the language, but these were mostly stripped out for the Strict variant of HTML 4.0. They weren't added back for the 4.01 bug fix, or the translation into XHTML that is XHTML 1.0.

    If you want to specify presentation, then CSS is the correct tool. If you want to do it with (X)HTML (a bad idea), then you need to use a Transitional varient of it (designed for use while browsers caught up with the CSS standards, which they did to a sufficient level about half a decade ago).

    Short answer: Aligning in XHTML 1.0 Strict without CSS is not possible.

  • 1 decade ago

    You can't use inline styles with XHTML strict.

    The answer is: don't use XHTML strict. No browser supports it properly anyway - they just render it as standard HTML. You're not losing anything by going back to HTML4.01 Transitional - which is just as much an "official" standard as HTML, if that's what's worrying you.

  • 1 decade ago

    If you are using an in-line style then you can do something like this:-

    <div style="text-align: center;">Here is some centered text</div>

  • How do you think about the answers? You can sign in to vote the answer.
  • 1 decade ago

    You can use inline style for that element if you don't want to create a complete style sheet, or change the doctype to transitional.

Still have questions? Get your answers by asking now.