PDA

View Full Version : Fixing table dimensions so that text does not stretch HELP


jinxyfeet
02-25-2007, 06:18 PM
Hi guys

I am having trouble fixing my table dimensions (http://www.tek-tips.com/viewthread.cfm?qid=1338692&page=1#) as to make sure the text does not force the user to have to scroll horizontally:

<a href="http://photobucket.com" target="_blank"><img src="http://i122.photobucket.com/albums/o251/jinxyfeet_photos/p2pstretch1.png" border="0" alt="Photobucket - Video and Image Hosting"></a>

I fixed this problem by finding this code from this site a few months ago:

<td width="775px" style="table-layout:fixed"

with this code the text fitted accordingly

<a href="http://photobucket.com" target="_blank"><img src="http://i122.photobucket.com/albums/o251/jinxyfeet_photos/socialnetworkingscreen.png" border="0" alt="Photobucket - Video and Image Hosting"></a>

However today i accendently deleted this code from my template

here is my current code


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<!-- TemplateBeginEditable name="doctitle" -->
<title>Untitled Document</title>
<!-- TemplateEndEditable -->
<!-- TemplateBeginEditable name="head" -->
<!-- TemplateEndEditable -->
<link href="../HTML_files/Style%20sheets/nav%20bar.css" rel="stylesheet" type="text/css">
<link href="../HTML_files/Style%20sheets/page%20text.css" rel="stylesheet" type="text/css">
<link href="../HTML_files/Style%20sheets/top%20bar.css" rel="stylesheet" type="text/css">
<link href="../HTML_files/Style%20sheets/bottom%20bar.css" rel="stylesheet" type="text/css">
<script language="JavaScript" type="text/JavaScript">
<!--
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_nbGroup(event, grpName) { //v6.0
var i,img,nbArr,args=MM_nbGroup.arguments;
if (event == "init" && args.length > 2) {
if ((img = MM_findObj(args[2])) != null && !img.MM_init) {
img.MM_init = true; img.MM_up = args[3]; img.MM_dn = img.src;
if ((nbArr = document[grpName]) == null) nbArr = document[grpName] = new Array();
nbArr[nbArr.length] = img;
for (i=4; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
if (!img.MM_up) img.MM_up = img.src;
img.src = img.MM_dn = args[i+1];
nbArr[nbArr.length] = img;
} }
} else if (event == "over") {
document.MM_nbOver = nbArr = new Array();
for (i=1; i < args.length-1; i+=3) if ((img = MM_findObj(args[i])) != null) {
if (!img.MM_up) img.MM_up = img.src;
img.src = (img.MM_dn && args[i+2]) ? args[i+2] : ((args[i+1])? args[i+1] : img.MM_up);
nbArr[nbArr.length] = img;
}
} else if (event == "out" ) {
for (i=0; i < document.MM_nbOver.length; i++) {
img = document.MM_nbOver[i]; img.src = (img.MM_dn) ? img.MM_dn : img.MM_up; }
} else if (event == "down") {
nbArr = document[grpName];
if (nbArr)
for (i=0; i < nbArr.length; i++) { img=nbArr[i]; img.src = img.MM_up; img.MM_dn = 0; }
document[grpName] = nbArr = new Array();
for (i=2; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
if (!img.MM_up) img.MM_up = img.src;
img.src = img.MM_dn = (args[i+1])? args[i+1] : img.MM_up;
nbArr[nbArr.length] = img;
} }
}
//-->
</script>
<style type="text/css">
<!--
a:link {
text-decoration: none;
}
a:visited {
text-decoration: none;
color: #FFCC33;
}
a:hover {
text-decoration: underline;
color: #666666;
}
a:active {
text-decoration: none;
color: #999999;
}
-->
</style></head>

<body onLoad="MM_preloadImages('../HTML_files/Over%20state%20button%20e%20commerce.png','../HTML_files/Over%20state%20button%20home.png','../HTML_files/Over%20state%20button%20business.png','../HTML_files/Over%20state%20button%20download.png','../HTML_files/Over%20state%20button%20entertainment.png','../HTML_files/Over%20state%20button%20communication.png','../HTML_files/Over%20state%20button%20bibliography.png','../Images/Over%20state%20button%20evaluation.png')">
<table width="100%" border="0">
<tr>
<td colspan="3"><img src="../HTML_files/logo%20back.png" width="1146" height="244"></td>
</tr>
<tr>
<td width="24%" class="navbar">Navigation Bar </td>
<td width="59%" class="topbar"><!-- TemplateBeginEditable name="Heading" -->
<div align="center"></div>
<!-- TemplateEndEditable --></td>
<td width="17%" class="navbar">Video/Audio/Images</td>
</tr>
<tr>
<td rowspan="2" valign="top" class="navbar"><table border="0" cellpadding="0" cellspacing="0">
<tr>
<td><a href="../HTML_files/online services main page.html" target="_top" onClick="MM_nbGroup('down','group1','Home','',1)" onMouseOver="MM_nbGroup('over','Home','../HTML_files/Over%20state%20button%20home.png','',1)" onMouseOut="MM_nbGroup('out')"><img src="../HTML_files/Up%20state%20button%20home.png" alt="" name="Home" width="261" height="52" border="0" onload=""></a></td>
</tr>
<tr>
<td><a href="../HTML_files/business.html" target="_top" onClick="MM_nbGroup('down','group1','Business','',1)" onMouseOver="MM_nbGroup('over','Business','../HTML_files/Over%20state%20button%20business.png','',1)" onMouseOut="MM_nbGroup('out')"><img src="../HTML_files/Up%20state%20button%20business.png" alt="" name="Business" width="261" height="52" border="0" onload=""></a></td>
</tr>
<tr>
<td><a href="../HTML_files/ecommerce.html" target="_top" onClick="MM_nbGroup('down','group1','Ecommerce','',1)" onMouseOver="MM_nbGroup('over','Ecommerce','../HTML_files/Over%20state%20button%20e%20commerce.png','',1)" onMouseOut="MM_nbGroup('out')"><img src="../HTML_files/Up%20state%20button%20e%20commerce.png" alt="" name="Ecommerce" width="261" height="52" border="0" onload=""></a></td>
</tr>
<tr>
<td><a href="../HTML_files/download.html" target="_top" onClick="MM_nbGroup('down','group1','Download','',1)" onMouseOver="MM_nbGroup('over','Download','../HTML_files/Over%20state%20button%20download.png','',1)" onMouseOut="MM_nbGroup('out')"><img src="../HTML_files/Up%20state%20button%20download.png" alt="" name="Download" width="261" height="52" border="0" onload=""></a></td>
</tr>
<tr>
<td><a href="../HTML_files/entertainment.html" target="_top" onClick="MM_nbGroup('down','group1','Entertainment','',1)" onMouseOver="MM_nbGroup('over','Entertainment','../HTML_files/Over%20state%20button%20entertainment.png','',1)" onMouseOut="MM_nbGroup('out')"><img src="../HTML_files/Up%20state%20button%20entertainment.png" alt="" name="Entertainment" width="261" height="52" border="0" onload=""></a></td>
</tr>
<tr>
<td><a href="../HTML_files/communication.html" target="_top" onClick="MM_nbGroup('down','group1','Communication','',1)" onMouseOver="MM_nbGroup('over','Communication','../HTML_files/Over%20state%20button%20communication.png','',1)" onMouseOut="MM_nbGroup('out')"><img src="../HTML_files/Up%20state%20button%20communication.png" alt="" name="Communication" width="261" height="52" border="0" onload=""></a></td>
</tr>
<tr>
<td><a href="../HTML_files/bibliography.html" target="_top" onClick="MM_nbGroup('down','group1','Bibliography','',1)" onMouseOver="MM_nbGroup('over','Bibliography','../HTML_files/Over%20state%20button%20bibliography.png','',1)" onMouseOut="MM_nbGroup('out')"><img name="Bibliography" src="../HTML_files/Up%20state%20button%20bibliography.png" border="0" alt="" onLoad=""></a></td>
</tr>
<tr>
<td><a href="../HTML_files/Evaluation.htm" target="_top" onClick="MM_nbGroup('down','group1','Evaluation','',1)" onMouseOver="MM_nbGroup('over','Evaluation','../Images/Over%20state%20button%20evaluation.png','',1)" onMouseOut="MM_nbGroup('out')"><img name="Evaluation" src="../Images/Up%20state%20button%20evaluation.png" border="0" alt="" onLoad=""></a></td>
</tr>
</table></td>
<td height="355" align="left" valign="top" bgcolor="#E0DFE3" class="Pagecontent"><!-- TemplateBeginEditable name="page content" -->page content <!-- TemplateEndEditable --></td>
<td rowspan="2" valign="top" class="navbar"><!-- TemplateBeginEditable name="Multimedia" -->Multimedia<!-- TemplateEndEditable --></td>
</tr>
<tr>
<td height="34" class="bottombar"><div align="center">|<a href="../HTML_files/online%20services%20main%20page.html">Home</a>|<a href="../HTML_files/business.html">Business services</a>|<a href="../HTML_files/ecommerce.html">E - commerce services</a>|<a href="../HTML_files/download.html">Download services</a>|<a href="../HTML_files/entertainment.html">Entertainment services</a>|<a href="../HTML_files/HTML%20_%20files/communication.html">Communication services</a>|<a href="../HTML_files/HTML%20_%20files/bibliography.html">Bibliography</a>|</div></td>
</tr>
</table>
</body>
</html>

--------------------

Where do i place the fixed layout code to make the text fit the cell again as it did it picture 2? HELP its for tommorow!

kona72
02-25-2007, 06:29 PM
The problem isn't your table it is your background image in the header,

See this line...



<td colspan="3"><img src="../HTML_files/logo%20back.png" width="1146" height="244"></td>



The actual pixel width of the background image is too big. You need to consider what resolution you want people to view your site at... (ex:800x600 or 1024x768) And then create that graphic accordingly. The table size is set to 100%...

davidj
02-25-2007, 07:00 PM
also rename your images so there are no spaces. They have been encoded so your going to have problems with images like this...

Over%20state%20button%20communication.png'

You also have errors in other areas of your code like your navigation at the bottom of the page. You need to remove the spaces from your directory structure...


<a href="../HTML_files/online%20services%20main%20page.html

jinxyfeet
02-25-2007, 07:51 PM
Thanks guys you have actually saved my life....I set the image to 100% width and it worked:-D:):grin:, i think after I have handed in this project I will begin to look into using CSS more as an overall "layout tool"