开发者

Rules for validating CSS height/width?

开发者 https://www.devze.com 2023-02-13 05:38 出处:网络
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 t

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 he开发者_C百科ight 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.


See the W3C page for height under Property Values. To answer your specific question, all of those values are permitted. Omitting the px has no effect.

0

精彩评论

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