Jump to content

fix image in the TD


asmith

Recommended Posts

hey guys

 

i have an image in a center a table TD, which the TD width and height is bigger than image .

 

when i change the browser size to a smaller one , the image moves (still remain in the center of the TD) .

 

i wanted to know how can i fix this image , that it stand on the center of the TD , but when i make the browser size smaller it won't move .

 

thanks

 

Link to comment
https://forums.phpfreaks.com/topic/85807-fix-image-in-the-td/
Share on other sites

If i understand you correctly...

 

You can change your table settings and "TD" settings and set them to a pixel size rather then a percent. So that the table and cell are both at a fixed size rather then in a sense a dynamic size. Now pending on the rest of your sites layout when you resize the browser it shouldnt move around.

 

Overall if your sites templating uses tables and your tables widths and heights are based on a percentage, and you dont have your alignments set up on the tables a cells to go with it your sites going to bend and strectch as much as your browser window is open or any one of your users for that matter.

 

I know its extra code as far as some might be concerned.. but what I do with almost every site I make is make one master table. then template the rest in accordingly..

 

 

<table border="0" width="500" id="table1" cellspacing="0" cellpadding="0" height="100%">
<tr>
	<td align="center" width="500" valign="top"> </td>
</tr>
</table>

 

Crude example to see what I mean..

<table border="0" width="500" id="table1" height="100%">
<tr>
	<td align="center" width="500" valign="top" height="50" bgcolor="#E2E2E2">
	Header</td>
</tr>
<tr>
	<td align="center" width="500" valign="top" bgcolor="#E2E2E2">
	<table border="0" width="500" id="table2" height="100%">
		<tr>
			<td align="center" valign="top" width="149" bgcolor="#FFFFFF">
			Menu<br>
			Menu<br>
			Menu<br>
			Menu<br>
			Menu<br>
			Menu</td>
			<td align="left" valign="top" bgcolor="#808080">
			Body.................................</td>
		</tr>
	</table>
	</td>
</tr>
<tr>
	<td align="center" width="500" valign="bottom" height="15" bgcolor="#E2E2E2">
	Footer</td>
</tr>
</table>

 

You can do much more then that pending on how you wanna lay out the site but like i said quick and crude example..

Link to comment
https://forums.phpfreaks.com/topic/85807-fix-image-in-the-td/#findComment-437920
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.