# New CSS Units in Codename One Apps

DevFeed: [New CSS Units in Codename One Apps](<https://devfeed.tech/articles/new-css-units-in-codename-one-apps-19399.md>)

Original publisher: [Read original article](<https://www.codenameone.com/blog/new-css-units-in-codename-one-apps/>)

Author: Steve Hannah

Published: 2021-07-07T00:00:00Z

Content type: release

Language: en

Sources: [CodeName One](<https://devfeed.tech/sources/codename-one.md>)

Topics: [CSS](<https://devfeed.tech/topics/css.md>), [ui](<https://devfeed.tech/topics/ui.md>)

Tags: [code](<https://devfeed.tech/tags/code.md>), [css](<https://devfeed.tech/tags/css.md>), [examples](<https://devfeed.tech/tags/examples.md>), [fonts](<https://devfeed.tech/tags/fonts.md>), [margin](<https://devfeed.tech/tags/margin.md>), [padding](<https://devfeed.tech/tags/padding.md>)

## AI overview

Codename One adds CSS-inspired units for setting margins, padding, and font sizes in CSS stylesheets, with corresponding Java constants. The article also explains viewport-based units and screen-independent-pixel settings for adapting default font sizes across devices and desktop platforms.

## Source excerpt

We've added some new units that you can use for specifying things like margin, padding and font sizes. You can use each of these units directly in your CSS stylesheets.