0

CSS 2.1 でサポートされていない CSS プロパティを使用しています。たとえば、-moz-border-radius、box-shadow、zoom、filter などを使用すると、CSS 検証に失敗します。

CSSバリデーターがそれらを無視するようにするテクニックはありますか?

4

1 に答える 1

1

Microsoft 固有の属性については、次の方法で条件付きコメントに含めることができます。

<!--[if IE 6]>
<style type="text/css">
    /* Use all the non-standard Microsoft Propreitary attributes */
    body {zoom: 1; filter: none;}
</style>
<![endif]-->

スタイルシートで何かを使用している場合は、次の方法で実行できます。

<!--[if IE 6]>
<link rel="stylesheet" href="ie6.css" type="text/css" />
<![endif]-->

これは W3C で完全に検証されます。次のコードを使用して確認します。

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <title>Untitled Document</title>
        <!--[if IE 6]>
        <style type="text/css">
            /* Use all the non-standard Microsoft Propreitary attributes */
            body {zoom: 1; filter: none;}
        </style>
        <![endif]-->
    </head>

    <body>

    </body>
</html>

直接入力による検証: http://validator.w3.org/#validate_by_input

その他の場合は、 Vendor Extentionsのオプションを設定して、CSS Validator で警告を表示するだけにすることができます。

于 2012-06-27T04:26:39.523 に答える