Right alignment of one column and left alignment in one table

I created an html table with two columns. I want the first column containing the text to be right-aligned, but I want the second column to remain to the left, since it contains checkboxes. For the presentation, it would look, but I do not know. I tried creating td class = "column1", then text-align: right; in CSS, but no luck.

We will be very grateful for any ideas.

HTML

<td class="column1">Retrieve Logs:</td> <td class="column2"><input type=checkbox name="getcamlogs" checked="checked"></td> 

CSS

 td.column1 { text-align: right; } 
+6
source share
1 answer

Here you go, this should work :)

 <style> #mytable {width:500px; margin:0 auto;} #mytable td {width:250px;} #mytable .left {text-align:right; background:#333;} #mytable .right {text-align:left; background:#666;} </style> <table id="mytable"> <tr> <td class="left">1</td> <td class="right">2</td> </tr> </table> 
+6
source

Source: https://habr.com/ru/post/896473/


All Articles