Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

centre

Status
Not open for further replies.

carlag

Technical User
Mar 6, 2005
34
AU
is there some code or option in dreamweaver to make sure that a table that is placed inside a layer is always centred?

so in every browser i preview my website in the site is in the centre of the page.

thankyou.
 
1 table single row, single cell with the alignment centered
Code:
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td><div align="center">All your content here ;-) </div></td>
  </tr>
</table>

Cheech

[Peace][Pipe]
 
i dont want to centre the table. That i have done. I just want to centre the entire website?
 
Code:
<html>
<body>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td><div align="center">

entire website here ;-) 

</div></td>
  </tr>
</table>
</body>
</html>

[Peace][Pipe]
 
cheech where do i insert that text to centre the website?

thanx

carla
 
You need to look at 2 things:
1. <div id="Layer1" style="position:absolute; left:213px;

2. Make sure the page validates. It's very broken viewed in FF. See:

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
 
As Johnwm has said the div that has absolute positioning is what is screwing things up, have a look at this code
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Crown Solutions - Premium plastic products</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
</head>
<body onLoad="MM_preloadImages('more.jpg','onea.jpg','twoa.jpg','threea.jpg','foura.jpg','fivea.jpg')">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><div align="center">





<div id="Layer1" >
  <table width="100%" height="678" border="0" bordercolor="#999999">
    <tr> 
      <td width="66%" height="155"><div align="center"><a href="index.htm" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image3','','onea.jpg',1)"><img src="one.jpg" name="Image3" width="174" height="153" border="0"></a><a href="company.htm" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image4','','twoa.jpg',1)"><img src="two.jpg" name="Image4" width="159" height="153" border="0"></a><a href="product.htm" onMouseOut="MM_swapImgRestore()" onMousedown="MM_swapImage('Image5','','threea.jpg',1)"><img src="three.jpg" name="Image5" width="136" height="153" border="0"></a><a href="enquiry.htm" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image6','','foura.jpg',1)"><img src="four.jpg" name="Image6" width="118" height="153" border="0"></a><a href="contact.htm" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image8','','fivea.jpg',1)"><img src="five.jpg" name="Image8" width="182" height="153" border="0"></a></div></td>
    </tr>
    <tr> 
      <td height="517" background="bgg.jpg"> <div id="Layer2" style="position:absolute; width:715px; height:433px; z-index:2; left: 31px; top: 174px;">
          <table width="100%" height="420" border="0">
            <tr> 
              <td height="229" colspan="3"> <p align="center">&nbsp;</p>
                <form name="form1" method="post" action="">
                  <div align="center"><font color="#336600" size="2" face="Arial, Helvetica, sans-serif"><strong>SUBSCRIBE:</strong></font> 
                    <font size="2" face="Arial, Helvetica, sans-serif"> 
                    <input type="text" name="textfield">
                    </font> </div>
                </form>
                <p align="center"><font face="Eurostile"><br>
                  </font> </p>
                <p align="center">&nbsp; </p>
                </td>
            </tr>
            <tr> 
              <td width="45%" height="185"><p align="center"><font face="Arial, Helvetica, sans-serif"><br>
                      </font><font face="Eurostile"> </font> </p>
                </td>
              <td width="34%"><div align="center"></div></td>
              <td width="21%"><div align="center"><font face="Eurostile"><br>
                  <br>
                  <br>
                  <br>
                      </font></div></td>
            </tr>
          </table>
        </div>
        <div align="center"></div>
        <p align="center"><font face="Eurostile"><br>
          </font><br>
          <br>
        </p>
        <p align="center"><font face="Eurostile"><br>
          </font></p>
        <p align="center">&nbsp;</p></td>
    </tr>
  </table>
</div>
</div></td>
  </tr>
</table>
</body>
</html>

Cheech

[Peace][Pipe]
 
[smile]Very comprehensive Cheech. I like to leave them some work!

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top