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.
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.
Try:
table {
float: right;
}
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;
}
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:
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>