I am trying to have the table lower and more to the right to were it originally is. How can i do this? What are the attributes? Thanks!
When adding a table to a web page, by default, it's aligned to the left side of the page or container, as shown below. The HTML source code for the table above is the following. To center this table, you would need to add ;margin-left:auto;margin-right:auto; to the end of the style attribute in the <table> tag.
You can use two values top and left along with the position property to move an HTML element anywhere in the HTML document. Move Left - Use a negative value for left. Move Right - Use a positive value for left. Move Up - Use a negative value for top.
You would want to use CSS to achieve that.
say you have a table with the attribute id="my_table"
You would want to write the following in your css file
#my_table{
margin-top:10px //moves your table 10pixels down
margin-left:10px //moves your table 10pixels right
}
if you do not have a CSS file then you may just add margin-top:10px, margin-left:10px
to the style attribute in your table element like so
<table style="margin-top:10px; margin-left:10px;">
....
</table>
There are a lot of resources on the net describing CSS and HTML in detail
As BalausC mentioned in a comment, you are probably looking for CSS (Cascading Style Sheets) not HTML attributes.
To position an element, a <table>
in your case you want to use either padding or margins.
the difference between margins and paddings can be seen as the "box model":
Image from HTML Dog article on margins and padding http://www.htmldog.com/guides/cssbeginner/margins/.
I highly recommend the article above if you need to learn how to use CSS.
To move the table down and right I would use margins like so:
table{
margin:25px 0 0 25px;
}
This is in shorthand so the margins are as follows:
margin: top right bottom left;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With