我在选取框标记中有一些文本。
<marquee direction="left" scrollamount="4">
Test Test Test Test Test
</marquee>
我正在使用 html 5 和 css 3。当我在 w3c 验证器中检查我的 html 时,它显示以下错误。
Element marquee not allowed as child of element div in this context. (Suppressing further errors from this subtree.)
<marquee direction="left" scrollamount="4">
如何解决这个问题?
最佳答案
Marquee 标签不是 html5(根本不是 html,而是 1995 年的 Microsoft 专有标签)
你可以:
- 使用 javascript 为您的文字添加动画
- 使用 css 动画 ( not fully browser compatible )
- 使用css3 marquee (不完全兼容浏览器)
- 使用选取框并忽略 W3C 警告(选取框完全兼容浏览器,即使在 iOS safari 中也是如此!)
- 不要使用跑马灯效果(很丑)
小心 W3C 验证器,它并不总是知道所有 W3C 规范!
关于w3c 验证中的 html 5 marquee 标记错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15128716/