/    Sign up×
Community /Pin to ProfileBookmark

I have the following code:

[QUOTE]

<table width=”600″ border=”0″ cellspacing=”2″ id=”foto1″ style=”display:block” align=’center’>
<tr>
<td width=”600″ height=”400″ align=”center” valign=”middle”><script type=”text/javascript”>
AC_FL_RunContent( ‘codebase’,’http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0′,’width’,’600′,’height’,’400′,’src’,’sale?img=2&id=<? echo $id ?>’,’quality’,’high’,’pluginspage’,’http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash’,’wmode’,’transparent’,’movie’,’sale?img=2&id=<? echo $id ?>’ ); //end AC code</script></td>
</tr>
</table>

[/QUOTE]

But the image does not show on center.

What parameter mas I use to center the image?

thanks

to post a comment
JavaScript

5 Comments(s)

Copy linkTweet thisAlerts:
@KorMay 06.2010 — the HTML [B]align="center"[/B] will center only the inline elements within a block-level elements, not the block level elements themselves. Anyway, you should use mainly CSS to style elements, not the HTML attributes. Some are deprecated.

Use CSS margin auto to center the element:
<i>
</i>&lt;table border="0" cellspacing="2" id="foto1" [COLOR="Blue"]style="display:block;
width:600px; margin:0 auto 0 auto;"[/COLOR]&gt;

Or even better give the table a [B][I]CSS class[/I][/B]
<i>
</i>&lt;style type="text/css"&gt;
[COLOR="Blue"]#foto1[/COLOR]{
display:block;
width:600px;
margin:0 auto 0 auto;
}
&lt;/style&gt;

<i>
</i>&lt;table border="0" cellspacing="2" [COLOR="Blue"]id="foto1"[/COLOR]&gt;
Copy linkTweet thisAlerts:
@JoseSilvaauthorMay 06.2010 — the HTML [B]align="center"[/B] will center only the inline elements within a block-level elements, not the block level elements themselves. Anyway, you should use mainly CSS to style elements, not the HTML attributes. Some are deprecated.

Use CSS margin auto to center the element:
<i>
</i>&lt;table border="0" cellspacing="2" id="foto1" [COLOR="Blue"]style="display:block;
width:600px; margin:0 auto 0 auto;"[/COLOR]&gt;

Or even better give the table a [B][I]CSS class[/I][/B]
<i>
</i>&lt;style type="text/css"&gt;
[COLOR="Blue"]#foto1[/COLOR]{
display:block;
width:600px;
margin:0 auto 0 auto;
}
&lt;/style&gt;

<i>
</i>&lt;table border="0" cellspacing="2" [COLOR="Blue"]id="foto1"[/COLOR]&gt;
[/QUOTE]


thanks for the tip.

I tried this way:
<i>
</i>&lt;style type="text/css"&gt;
.foto1{
display:block;
width:600px;
margin:0 auto 0 auto;
}
&lt;/style&gt;


<i>
</i> &lt;table border="0" cellspacing="2" id="foto1" class="foto1"&gt;
&lt;tr&gt;
&lt;td&gt;&lt;script type="text/javascript"&gt;
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','600','height','400','src','sale?img=2&amp;id=&lt;? echo $id ?&gt;','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','wmode','transparent','movie','sale?img=2&amp;id=&lt;? echo $id ?&gt;' ); //end AC code&lt;/script&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;


But not works.

Why?
Copy linkTweet thisAlerts:
@KorMay 06.2010 — Should work, it works for me:
<i>
</i>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"&gt;
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Untitled Document&lt;/title&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"&gt;
&lt;meta http-equiv="Content-Style-Type" content="text/css"&gt;
&lt;meta http-equiv="Content-Script-Type" content="text/javascript"&gt;
&lt;style type="text/css"&gt;
.foto1{
display:block;
width:600px;
margin:0 auto 0 auto;
background:#ccc;
}
&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;table border="0" cellspacing="2" id="foto1" class="foto1"&gt;
&lt;tr&gt;
&lt;td&gt;something&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/body&gt;
&lt;/html&gt;
Copy linkTweet thisAlerts:
@JoseSilvaauthorMay 07.2010 — Should work, it works for me:
<i>
</i>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"&gt;
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Untitled Document&lt;/title&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"&gt;
&lt;meta http-equiv="Content-Style-Type" content="text/css"&gt;
&lt;meta http-equiv="Content-Script-Type" content="text/javascript"&gt;
&lt;style type="text/css"&gt;
.foto1{
display:block;
width:600px;
margin:0 auto 0 auto;
background:#ccc;
}
&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;table border="0" cellspacing="2" id="foto1" class="foto1"&gt;
&lt;tr&gt;
&lt;td&gt;something&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/body&gt;
&lt;/html&gt;
[/QUOTE]


Hi again

Sorry, but better give you the full script because does not work with me. Might be something that I'm making wrong.

[code]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>PRODUCT PHOTOS</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="Content-Style-Type" content="text/css">
<meta http-equiv="Content-Script-Type" content="text/javascript">
<style type="text/css">
.style8 {font-family: Arial, Helvetica, sans-serif; font-size: 11px; color: #24231E; font-weight: bold; }

.foto{
display:block;
width:600px;
margin:0 auto 0 auto;
background:#ccc;
}

</style>
</head>
<body>



<?
include "call_db.inc.php";
$sql="select * from inter_main_".$paiscode." where sale='1' and id=$id limit 1";
$result=mysql_db_query("db_name",$sql) ;
$regist=mysql_fetch_array($result);
$id=$regist["id"];
$reference=$regist["reference"];
$coun=$regist["county"];
$cit=$regist["city"];
$zipcode=$regist["zipcode"];
$stat=$regist2["state"];
$count=$regist["country"];

?>
<script>
function muda(){
if(document.getElementById('foto1').style.display = 'none'){
document.getElementById('foto1').style.display = 'block';
document.getElementById('foto2').style.display = 'none';
document.getElementById('foto3').style.display = 'none';
document.getElementById('info').style.display = 'none';
document.getElementById('visita').style.display = 'none';
}
}
function muda2(){
if(document.getElementById('foto2').style.display = 'none'){
document.getElementById('foto2').style.display = 'block';
document.getElementById('foto1').style.display = 'none';
document.getElementById('foto3').style.display = 'none';
document.getElementById('info').style.display = 'none';
document.getElementById('visita').style.display = 'none';
}
}
function muda3(){
if(document.getElementById('foto3').style.display = 'none'){
document.getElementById('foto3').style.display = 'block';
document.getElementById('foto1').style.display = 'none';
document.getElementById('foto2').style.display = 'none';
document.getElementById('info').style.display = 'none';
document.getElementById('visita').style.display = 'none';
}

}


</script>


<table width='680' border='0' cellspacing='0' cellpadding='0' align="center">
<tr>
<td align='center'><img src='images/frames/img/fundo_top.png' width='680'></td>
</tr>
<tr>
<td align='center' valign='top' style='background:url(images/frames/img/fundo1.png) repeat-y'>

<table border="0" cellspacing="2" id="foto1" class="foto">
<tr>
<td><script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','600','height','400','src','sale?img=2&id=<? echo $id ?>','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','wmode','transparent','movie','sale?img=2&id=<? echo $id ?>' ); //end AC code</script></td>
</tr>
</table>
<table border="0" cellspacing="2" id="foto2" class="foto">
<tr>
<td width="600" height="400" align="center" valign="middle"><script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','600','height','400','src','sale?img=3&id=<? echo $id ?>','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','wmode','transparent','movie','sale?img=3&id=<? echo $id ?>' ); //end AC code</script></td>
</tr>
</table>
<table border="0" cellspacing="2" id="foto3" class="foto">
<tr>
<td width="600" height="400" align="center" valign="middle"><script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','600','height','400','src','sale?img=4&id=<? echo $id ?>','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','wmode','transparent','movie','sale?img=4&id=<? echo $id ?>' ); //end AC code</script></td>
</tr>
</table>

</td>
</tr>
<tr>
<td align='center'><img src='images/frames/img/fundo_bot.png' width='680'></td>
</tr>
</table>

<table width='680' border='0' cellspacing='0' cellpadding='0' align="center">
<tr>
<td align='center'><img src='images/frames/img/fundo_top.png' width='680' height='16'/></td>
</tr>
<tr>
<td height='10' align='center' valign='top' style='background:url(images/frames/img/fundo1.png) repeat-y'>

<table width="650" border="0">
<tr>
<td align="center"><table width="650" height="95" border="0" cellpadding="0" cellspacing="0" align="center">
<tr>
<td width="95" height="95" background="admin/get_miniature.php?img=2&cliente=<? echo"$id"; ?>&max_height=95'" bgcolor="#FFFFFF" style="background-position:center; background-repeat:no-repeat"><a href="javascript: muda();" onclick="muda();"><img src="images/tumbmain.png" width="95" height="95" border="0" /></a></td>
<td width="60" height="95">&nbsp;</td>
<td width="95" height="95" background="admin/get_miniature.php?img=3&cliente=<? echo"$id"; ?>&max_height=100'" bgcolor="#FFFFFF" style="background-position:center; background-repeat:no-repeat"><a href="javascript: muda2();" onclick="muda2();"><img src="images/tumbmain.png" width="95" height="95" border="0" /></a></td>
<td width="60" height="95">&nbsp;</td>
<td width="95" height="95" background="admin/get_miniature.php?img=4&cliente=<? echo"$id"; ?>&max_height=100'" bgcolor="#FFFFFF" style="background-position:center; background-repeat:no-repeat"><a href="javascript: muda3();" onclick="muda3();"><img src="images/tumbmain.png" width="95" height="95" border="0" /></a></td>
</tr>
</table></td>
</tr>
</table>




</td>
</tr>
<tr>
<td align='center'><img src='images/frames/img/fundo_bot.png' width='680' height='16'/></td>
</tr>
</table>

</body>
</html>
</code>


Let see if you can help here.

Thanks
Copy linkTweet thisAlerts:
@JoseSilvaauthorMay 07.2010 — Hi

I manage to centering the image.

thanks for the help
×

Success!

Help @JoseSilva spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...