验证 CSS 高度/宽度的规则?
我正在创建一个输出
这些是我以前见过的高度和宽度设置类型。这些都有效吗?我在哪里可以找到所有接受的格式?是否有任何值被认为无效,但被用作跨浏览器兼容性的技巧?
- 1px
- 10%
- 99.99%
- 100
我可能只是让用户在这些字段中输入他们想要的任何内容,但现在我很好奇。
I'm creating an ASP.NET control that outputs <object>
and <embed>
tags. I want the control to have "Height" and "Width" properties, since both of those tags require them. I was also thinking of validating the height and width at runtime. I'm wondering exactly what the valid ranges are so I can be sure I have valid sizes.
These are the types of height and width settings I've seen before. Are these all valid? Where could I find all the accepted formats? Are there any values that are considered invalid, but are used as tricks for cross-browser compatibility?
- 1px
- 10%
- 99.99%
- 100
I may just go the route of letting the user input whatever they want in these fields, but now I'm curious.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
请参阅 属性值下的
height
W3C 页面。为了回答您的具体问题,所有这些值都是允许的。省略px
没有任何效果。See the W3C page for
height
under Property Values. To answer your specific question, all of those values are permitted. Omitting thepx
has no effect.