Rules for validating CSS height/width?

199 views Asked by At

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.

1

There are 1 answers

0
ChessWhiz On BEST ANSWER

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.