Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

nativescript css unit of measurement

i have been playing arround with nativescript and i see that it offers us to style elements using css.

However in the docs http://docs.nativescript.org/ui/styling.html i see nothing mentioned about the unit of measurement for css.

This works

.title {
    font-size: 30;
    horizontal-align: center;
    margin: 20;
}

And this does not work

.title {
    font-size: 30;
    horizontal-align: center;
    margin: 20px;
}

Notice that margin is 20px in the second example.

So my question is when it comes to css what unit does nativescript use?

like image 748
krv Avatar asked Dec 29 '15 13:12

krv


1 Answers

If someone came across this question in 2019 and beyond, the documentation specifies the units of measurements in Nativescript.

"NativeScript supports DIPs (Device Independent Pixels), pixels (via postfix px) and percentages (partial support for width, height and margin) as measurement units.

NativeScript's recommended measurement unit is DIP. All measurable properties like width, height, margin, paddings, border-width, etc.) support device independent pixels. The font sizes are always measured in DIPs."

Link: https://docs.nativescript.org/ui/styling#supported-measurement-units

like image 124
Amjad Abujamous Avatar answered Sep 23 '22 05:09

Amjad Abujamous