ERRO ao vaidar codigo HTML utilizando a DTD Strict

2 respostas
rafa.spimenta

Introdução:
Bom galera, estou iniciando em código html, e estou tentando aprender a fazer as minhas páginas em conformidade com as standards que no caso é a DTD strict.

Duvida:

estou tentando válidar meu código no site da W3C, mas nao estou conseguindo devido a um erro nessa instrução:

<p align="center">Texto alinhado a esquerda.</p>

segue a msg de erro:

1. Error Line 24, Column 17: there is no attribute “ALIGN”.

<p align="center">Texto alinhado a esquerda.</p>

  You have used the attribute named above in your document, but the document type you are using does not support that attribute for this element. This error is often caused by incorrect use of the "Strict" document type with a document that uses frames (e.g. you must use the "Transitional" document type to get the "target" attribute), or by using vendor proprietary extensions such as "marginheight" (this is usually fixed by using CSS to achieve the desired effect instead).

  This error may also result if the element itself is not supported in the document type you are using, as an undefined element will have no supported attributes; in this case, see the element-undefined error message for further information.

  How to fix: check the spelling and case of the element and attribute, (Remember XHTML is all lower-case) and/or check that they are both allowed in the chosen document type, and/or use CSS instead of this attribute. If you received this error when using the <embed> element to incorporate flash media in a Web page, see the FAQ item on valid flash.

Para que esse erro nao continuasse a acontecer, troquei o atributo “align” da tag “p” pelo atributo “dir”. entretando o atributo “dir” da tag “p” só aceita dois parâmetro que são: “ltr(Alinado esquerda e rtl(alinhado direita)”, e nao aceita parametro para alinhar meu texto no centro, entao voltei a usar a tag “p” com o atributo “align=center”; atributo este que a w3c nao aceita na tag “p”, no caso de usar a DTD Strict.

Conclusão:

O que eu devo fazer para validar meu codigo e conseguir alinha meu texto no centro.

Espero ter sido claro, apedar de ser sido maçante.
agradeço desde ja!

vlwwss!! :lol:

segue codigo fonte:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">

<html>
    <head>
        <meta name="generator" content="HTML Tidy, see www.w3.org">
        <meta name="generator" content=
        "P&aacute;ginas de treinamento b&aacute;sico HTML Rafael">
        <meta http-equiv="Content-language" content="pt-br">
        <meta http-equiv="Content-Type" content=
        "text/html; charset=iso-8859-1">
        <meta name="author" content="Rafael Pimenta">
        <meta name="reply-to" content="[email removido]">

        <title>Minha primeira p&aacute;gina</title>
    </head>

    <body>
        <p>Bem-vindo</p>

        <p>Voc&ecirc; est&aacute; na p&aacute;gina <b>Comida para
        todos</b>.</p>

        <p align="center">Texto alinhado a esquerda.</p>

        <p dir="ltl">Texto alinha a direita.</p>

        <p dir="rtl">paragrafo1</p>
    </body>
</html>

2 Respostas

furutani

Olá

Por que não usa CSS?

rafa.spimenta

bom meio dificil d eu responder sua pergunta! rs

eu ainda n sei cmo usar css, pois eestou começando agora e estou vendo basico de html e me disseram e eu pesquise q o melhor é começar com html, css, xhtml, xml, javascript, php, servidores(apache), banco de dados(mysql), jsp, ajax, Servlet e j2ee nesta ordemm…

Criado 10 de março de 2008
Ultima resposta 10 de mar. de 2008
Respostas 2
Participantes 2