Margin CSS property and multiple sides

4 posts, 0 answers
  1. TJ
    TJ avatar
    58 posts
    Member since:
    Aug 2013

    Posted 08 Jan 2015 Link to this post

    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
  2. Alex
    Admin
    Alex avatar
    129 posts

    Posted 09 Jan 2015 Link to this post

    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.

     
  3. TJ
    TJ avatar
    58 posts
    Member since:
    Aug 2013

    Posted 09 Jan 2015 in reply to Alex Link to this post

    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
  4. Alex
    Admin
    Alex avatar
    129 posts

    Posted 09 Jan 2015 Link to this post

    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.

     
Back to Top