How to use align in css for tables [closed]

-3

How do I set this table in css?

<table border="0" align="right">

I want to know how to align a table right using css.

    
asked by anonymous 10.05.2016 / 14:08

4 answers

2

Try:

 table {
     float: right;
 }
    
10.05.2016 / 14:36
0

I think the problem is that your page has margin or padding that does not allow your table to "paste" on the right, try the solution below and adapt it to the rest of your code so your entire page will not break: p>

<table border="1" align="right">

CSS:

*{
    margin: 0px;
    padding: 0px;
}
    
10.05.2016 / 14:24
0

Try this:

table {
    /*margin-right: 10%; /* distância até chegar em 100% (baseando-se no lado direito) */
    margin-left: 100% !important;/* distância até chegar em 100% (baseando-se no lado esquerdo) */
}

JSFiddle:

link

    
10.05.2016 / 14:13
0

So much so in the following ways, using float: right; if you want to put your table on the right, and if you want to align your text right inside the table, use text-align: right; .

table.table-1 {
  width: 100px;
  background: #ccc;
  float: right;
  margin-bottom: 10px;
}

table.table-2 {
  width: 100%;
  background: #ccc;
  text-align: right;
  clear: both;
}
<table class="table-1">
  <tr>
    <td>Tabela 1</td>
  </tr>
</table>

<table class="table-2">
  <tr>
    <td>Tabela 2</td>
  </tr>
</table>
    
10.05.2016 / 14:36