Search code examples
htmlcssalignmentlinescss-tables

Align paragraphs in the same line inside a table


I've been trying to make three paragraphs finish in the same line and I couldn't do it. Here's the link for an example.

CSS Code for the paragraphs:

.taula3columnes td p
{
    text-align: justify;
    text-justify: inter-word;
    font-size: 14px;
    margin: 8px;
    width: auto;
}

I'd like to have the three paragraphs aligned so they finish in the same line. I've been trying with text-justify CSS property but I haven't been able.

Any solution for this?


Solution

  • According to your requirement you need to use column-count property. Remove all the td and p. keep only one td and assign the css like below.

    .taula3columnes td
    {
    text-align: justify;
    text-justify: inter-word;
    font-size: 14px;
    margin: 8px;
    width: auto;
    -webkit-column-count:3;
    -moz-column-count:3;
    column-count:3;
    }
    

    DEMO