简体   繁体   English

在一行中显示电话号码的jsx问题

[英]jsx problem displaying a phone number in one line

I have a simple problem, but I could not figure out the solution for it.我有一个简单的问题,但我想不出解决方案。 I have this element我有这个元素

<tr className="list-group-item list-item row">
    <td className="col">Phone number :</td>
    <td className="col">{this.state.phone_number}{""}</td>
</tr>

I expect it to display one line row like this我希望它像这样显示一行

Phone number :        +1 773-381-0000                     

however it displays this但是它显示了这个

                      +1 
Phone number :        773-
                      381-
                      0000

You can try the nowrap attribute to display properly.您可以尝试使用nowrap属性来正确显示。

https://www.w3schools.com/tags/tryit.asp?filename=tryhtml_td_nowrap https://www.w3schools.com/tags/tryit.asp?filename=tryhtml_td_nowrap

<tr className="list-group-item list-item row">
       <td className="col">Phone number :</td>
       <td  style="white-space: nowrap;" className="col">{this.state.phone_number}{""}</td>
</tr>

Your problem is that there is not enough space in the table and the text wraps.您的问题是表格中没有足够的空间并且文本换行。

The row and col bootstrap classes don't work well with tables. rowcol bootstrap 类不适用于表。 Check responsive table here https://mdbootstrap.com/docs/jquery/tables/responsive/在此处检查响应表https://mdbootstrap.com/docs/jquery/tables/responsive/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM