简体   繁体   中英

What data types do width and style.width accept?

I am a first time JavaScript student and I have a school question, we need to indicate the data types that width and style.width accept.

I know data types are number, string, null, undefined, boolean and object. We haven't learned to code yet so I don't know how to test my answers nor can I find it on the web.

The properties on the style object is based on the CSS spec, specified as a String value eg element.style.width = '10px' . As for width, please read more here . More specifically what is eligible to be used, please see width<length> and width<percentage>
If you try to set an invalid value, it will be invalidated and not applied on the element.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM