Aligning cell contents vertically

Aligning cell contents vertically

Emmy90Emmy90 Posts: 2Questions: 0Answers: 0

Hi, I'm very inexperienced so I just have a quick question to see if what I'm trying to do is even possible. I've put expanding text in a cell and when the user clicks on it, the height of the whole table row increases (as expected). This means the single line of text in other columns moves down the page (like it's center-aligned to the largest cell). Is it possible to have the text always be vertically aligned to the top of the cell/row no matter how large the cell is?

Replies

  • allanallan Posts: 62,355Questions: 1Answers: 10,230 Site admin

    In your CSS add:

    table.dataTable tbody td {
      vertical-align: top;
    }
    

    Its one of the rare cases in CSS where vertical-align actually makes any sense :-)

    Allan

  • Emmy90Emmy90 Posts: 2Questions: 0Answers: 0

    Thank you allan, I was hoping it was as simple as that! DataTables is excellent and is helping me to create the perfect table for my site :).

  • himaantheonehimaantheone Posts: 2Questions: 1Answers: 0

    same problem with me thanks for the answer

This discussion has been closed.