This is a migrated thread and some comments may be shown as answers.

Margin CSS property and multiple sides

3 Answers 15 Views
NativeScript Insiders
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
TJ
Top achievements
Rank 1
TJ asked on 08 Jan 2015, 10:29 PM
Hey all,

I had a question about the current implementation of the margin CSS property. Correct me if I'm wrong, but currently it seems like the margin property only accepts a single integer value—e.g. 4.

I was hoping that NativeScript's margin, like CSS's, would accept 1–4 values so that I could set the margin of each side of a given element. Is that currently possible, or are there plans to make that possible in the future?

Thanks,
TJ

3 Answers, 1 is accepted

Sort by
0
Alex
Telerik team
answered on 09 Jan 2015, 07:55 AM
Hi TJ,
Multiple values for the margin property are supported. However in the 0.42 release we had a couple of bugs:
  • Only "," was accepted as value separator. So "margin: 10, 20, 30, 40" will work, but "margin: 10 20 30 40" will not.
  • Values which are 0 are sometimes not respected. So "margin: 10, 20" will work, but "margin: 20, 0" will not.

Good news i that both are already fixed.
Hope that helps.

Regards,
Alex
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
TJ
Top achievements
Rank 1
answered on 09 Jan 2015, 03:17 PM
Hey Alex,

That helps, but I noticed that the current order of values is not consistent with CSS. For instance, if I set my margin to `1 2 3 4`, in CSS `1` is the *top* margin, but in NativeScript it's the *left* margin. The inconsistency messed with my brain for a few minutes.

It would also be nice if the side-specific properties—margin-left, margin-top, margin-right, and margin-bottom—were supported as well. After I noticed the inconsistent order I tried to use these and found they didn't exist.

Thanks,
TJ
0
Alex
Telerik team
answered on 09 Jan 2015, 04:08 PM
Hi,
Thank for the feedback - we have added both suggestions to the backlog.

Regards,
Alex
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
NativeScript Insiders
Asked by
TJ
Top achievements
Rank 1
Answers by
Alex
Telerik team
TJ
Top achievements
Rank 1
Share this question
or