开发者

2 questions on writing a valid CSS 2.1 stylesheet without errors

I have two questions on how to write a correct/without error CSS 2.1 stylesheet:

  1. The CSS validator says to me that overflow-y: scroll is not supported on CSS 2.1. So, what can I use for the same effect?
  2. I have something like 500 warnings that say Same colors for color and background-color in two contexts .error and .contact3 (about different classes, of开发者_JS百科 course), what does it mean? And how can I resolve this?


1. CSS validator say to me that overflow-y: scroll is not supported on CSS 2.1. So, what can I use for the same valid effect?

They're not valid because they were introduced in CSS3. In CSS 2.1, you can only set overflow for both horizontal and vertical at the same time.

Most browsers support overflow-y now, so I would worry less about 2.1 validation (as your CSS will be valid with a CSS 3 validator). You can use overflow: auto as a fallback for unsupported browsers.

2. I have somethings like 500 warning that say Same colors for color and background-color in two contexts .error and .contact3 (about different classes, of course) , what does it means? And how can I resolve this trouble?

The problem is what it says it is. If you have the background-color the same as the color, it generates a warning because any text will not be visible to the user. If that is your intention, you would be better off setting the foreground color to transparent on those elements:

.error {
    color: transparent;
}

Beyond that, though, warnings are just warnings and your CSS is valid with them. Warnings exist to let you know that you may have made a mistake.


You can use overflow:auto; This will add scrollbars when needed.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜