How to prevent line-break in a column of a table cell (not a single cell)?

后端 未结 9 957
粉色の甜心
粉色の甜心 2020-12-07 23:43

How can I prevent automatic line breaks in a column of table (not a single cell)?

相关标签:
9条回答
  • 2020-12-08 00:26

    To apply it to the entire table, you can place it within the table tag:

    <table style="white-space:nowrap;">

    0 讨论(0)
  • 2020-12-08 00:28

    Just add

    style="white-space:nowrap;"
    

    Example:

    <table class="blueTable" style="white-space:nowrap;">
       <tr>
          <td>My name is good</td>
        </tr>
     </table>
    
    0 讨论(0)
  • 2020-12-08 00:34
    <table class="blueTable">
      <tr>
         <td>My name is good</td>
       </tr>
    </table> 
    <style>   
        table.blueTable td,
        table.blueTable th {
            white-space: nowrap;
            /* non-question related further styling */
            border: 1px solid #AAAAAA;
            padding: 3px 2px;
            text-align: left;
        }
    </style>
    

    This is an example usage of the white space property with value nowrap, the bluetable is the class of the table, below the table are the CSS styles.

    0 讨论(0)
提交回复
热议问题