Vortex852456
Vortex852456

Reputation: 739

XHTML 1.0 Strict - div align="center" still working?

I'm playing around with the doctypes to find the best one for me. I'm thinking about to use XHTML 1.0 strict, because it shouldn't accept the deprecated elements and attributes. To test the behaviour, I created an html page with the following content:

<!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">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
</head>
<body>
    <div align="center">
        Some Text
    </div>
</body>
</html>

When I open this with Firefox the div has 100% width (which is ok) and it's text is aligned to center (which is not ok, the align attribute isn't supposed to work anymore).

Can someone explain why this is happening? Am I doing something wrong or are some deprecated attributes still accepted in strict mode?

Upvotes: 2

Views: 1124

Answers (1)

Quentin
Quentin

Reputation: 944528

Doctype switching triggered Standards Mode has nothing to do with enforcing lack of support for deprecated/removed attributes. Most of the effects it has are on disabling the emulation of bugs (such as incorrect handing of width and assuming integer values are pixel values) in CSS support.

Use a validator to detect when you are using a deprecated HTML feature.

Upvotes: 3

Related Questions