隐藏列中的元素(< b< b>/b< b>) [英] Hide elements (<br><b></b><br>) in a column

查看:104
本文介绍了隐藏列中的元素(< b< b>/b< b>)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Knack在线数据库创建应用程序.我正在尝试寻找一种方法来隐藏单元格中的空白空间.

I'm using Knack Online Database to create apps. I'm trying to find a way to hide empty space in a cell.

我有一个带有文本公式的表.文本公式组合了多个字段(问题和答案),并使用<br>分隔它们.这就是我的设置方式:

I have a table that has a text formula. The text formula combines multiple fields (question and answers) and separates them using <br>. This is how i have it set up:

<b>question1</b> answer1
<br>
<b>question2</b> answer2
<br>
<b>question3</b> answer3
<br>

对于某些记录,某些字段为空,因此结果如下:

For some records, some of the fields are empty so this is how it results:

<b>question1</b> answer1
<br>
<b></b>
<br>
<b>question2</b> answer2
<br>

在我的表格中,将显示空白区域,并且将占用大量空间:

In my table, the empty space would show and it would take so much space: Table

我尝试使用此代码,但没有用:

I've tried using this code but it didn't work:

$(document).on('knack-view-render.view_2665', function(event, view, data) {
  removeWhiteSpaces('kn-input-field_3288');
});

我不确定隐藏空白区域的最佳解决方案是什么.如果此列/字段的<b></b>为空,是否可以使用代码隐藏<b></b><br>?

I'm not sure what's the best solution to hide the empty space. Is there a code that I could use to hide the <b></b><br> if the <b></b> was empty for this column/field?

推荐答案

在CSS中也许是这样的事情?

Perhaps something like this in your CSS?

b:empty + br:empty,
b:empty {
  display: none;
}

这将隐藏每个空的<b>标记以及在空的<b>之后放置的所有空的<br>.

This would hide every empty <b> tag and any empty <br> placed after an empty <b>.

这是一个小提琴.

这篇关于隐藏列中的元素(&lt; b&lt; b&gt;/b&lt; b&gt;)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆