Support » Plugin: TablePress - Tables in WordPress made easy » Text alignment in columns

  • Resolved keithvaugh

    (@keithvaugh)


    Hi

    I have created a table where I want the text in the left column to be aligned left and all other columns aligned center. The only CCS that I have found that seems to works is:

    .tablepress thead th {
    	background-color: transparent;
    	text-align: center;
    }
    
    .tablepress .column-1 td {
    	text-align: left;
    }
    
    .tablepress .column-1 {
    	width: 300px;
    }
    
    .tablepress-id-1 .column-2 {
    	text-align: center;
    }
    
    .tablepress-id-1 .column-3 {
    	text-align: center;
    }

    As you can see you have to virtually add the same code for each column. I have tried:

    .tablepress-id-1 .column-2 .column-3 .column-4 {
    	text-align: center;
    }

    But that doesn’t seem to work. Is there a tidy way of achieving this?

    Thanks in advance.

    http://wordpress.org/plugins/tablepress/

Viewing 1 replies (of 1 total)
  • Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    thanks for your question, and sorry for the trouble.

    Combining CSS selectors works slightly different. In your example, that would be

    .tablepress-id-1 .column-2,
    .tablepress-id-1 .column-3,
    .tablepress-id-1 .column-4 {
    	text-align: center;
    }

    However, the better and simpler solution should be to set the alignment to “center” for all columns first, and then set it to “left” again for the first column. That way, you don’t have to adjust the code everytime you add a column:

    .tablepress-id-1 th,
    .tablepress-id-1 td {
    	text-align: center;
    }
    .tablepress-id-1 .column-1 {
    	text-align: left;
    }

    Regards,
    Tobias

Viewing 1 replies (of 1 total)
  • The topic ‘Text alignment in columns’ is closed to new replies.