Reputation: 149
I've been looking for a way to position one of my tables that has an image in it. Its a little bit far to the left and I need to scoot it over to the right. So far my table is written like:
<TD>
<IMG SRC='http://farm8.staticflickr.com/7209/6978440877_10b1fcffc4_o.jpg'/>
</TD>
What do I need to add? I tried some css like:
position:absolute; z-index:2; left: 50px; top: 1040px;
-but it just appeared on the page as text. What should I add/write so that I can control where I put my table?
Upvotes: 0
Views: 107
Reputation: 1546
Try the following style for <Body>
and <TD>
tag it will remove the left space.
<body style="margin:0; padding:0;">
<TD style="padding-left:0;" >
If still unable to fix, please provide the complete code.
Upvotes: 0
Reputation: 22065
When you make a table in HTML you at least need to define the table, rows, and cells (not sure if you had these already, just posting truncated code):
<table>
<tr>
<td> ... </td>
</tr>
</table>
When you define CSS it needs to be in the proper place. You have a few choices. First, you can put it inline in a tag like this:
<table style="attribute:value; attribute:value;">
Or you can define it in the <head>
(preferred):
<head>
...
<style type="text/css">
table{
attribute:value;
attribute:value;
}
</style>
</head>
Finally, that 1000 pixel offset is pretty high. Get comfortable with both relative and absolute positioning. Absolute positioning can lead to a lot of issues for beginners who don't understand how layouts flow together in my experience.
Hopefully that will get you started. There are a lot of great resources out there.
Upvotes: 1