Skip to main content

Extra spaces between empty values when columns set to other than short

  • October 13, 2018
  • 1 reply
  • 2 views

Forum|alt.badge.img+3
  • Participating Frequently
  • 6 replies

Just a minor inconsistency here. I’m not sure which is supposed to be the “right” one.

I have this function, which has some values that are empty in it (no subtype is set for these records).

Despite the extra space after the empty value, they look alright…but only in “short” view.

In taller views the spaces appear, looking rather icky.

I suppose technically they should have double spaces, as in the function? (Although that leaves me with no way to make an attractive title.) Either way, it’s odd that it behaves differently on different views and it didn’t look like anyone had mentioned it so far, so I thought I would :slightly_smiling_face:

1 reply

Forum|alt.badge.img+5
  • Inspiring
  • 1386 replies
  • October 14, 2018

With ‘short’ row-height, Airtable sets the CSS white-space property to ‘nowrap’. This causes sequences of white-space characters to collapse to a single space. (This is also why embedded newlines appear as a space rather than as a line-break.)

For other row heights, white-space is set to ‘pre’. This preserves embedded space characters and wraps at line breaks. Sequential space characters are treated as multipler spaces, and embedded newlines (’\n’) cause a line break.

To ensure a single space between values, change your formula to

Size&IF(
    Subtype,
    ' '&Subtype
    )&IF(
        Format,
        ' '&Format
        )

Edit: I should note I didn’t actually check how Airtable sets the CSS property before posting this. I’ve done so in the past, and these are the most likely values, based on performance. That said, Airtable is an extremely complex web app, and it may use other methods to achieve similar outcomes.


Reply