Skip to content Skip to sidebar Skip to footer

Word-wrap In A CSS Grid

word-wrap: break-word doesn't work in a grid. For tables there is table-layout: fixed, what is the equivalent for grids?

Solution 1:

You cant use it in td but you can add another div inside td. However, you have to give some width to break the words.

    <div style="background: #e3e3e3; width: 75%;">

         <table>
           <tr><td>
            <div style="width:200px;word-wrap: break-word;"> badtablebadtablebadtablebadtablebadtablebadtablebadtablebadtablebadtablebadtablebadtablebadtablebadtable
            </div>
           </td></tr>
         </table>

      <div style="display: grid;">
        <div style="word-wrap: break-word;width:200px;">     griddivgriddivgriddivgriddivgriddivgriddivgriddivgriddivgriddivgriddivgriddivgriddivgriddivgriddivgriddivgriddiv
      </div>
      </div>

        </div>

Post a Comment for "Word-wrap In A CSS Grid"