Centered Text jumps around from page to page

liunx

Guest
The following is the beginning of my code, with the area i believe to be causing me trouble highlighted in red:<br />
<br />
<html> <br />
<head><br />
<link rel="stylesheet" type="text/css" href=http://www.htmlforums.com/archive/index.php/"filename.css" ><br />
<style type="text/css"><br />
<!--<br />
A {text-decoration:none; color:black}<br />
A:hover {text-decoration:underline; color:white}<br />
// --><br />
</style><br />
<br />
<title>One Stop... everything in one place</title> <br />
<br />
<br />
</head><br />
<body topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0"> <br />
<br />
<br />
<table bgcolor="#6699FF" width="100%" height="90"><br />
<tr><td><img WIDTH="100" HEIGHT="100" SRC=http://www.htmlforums.com/archive/index.php/"/images/barn2.gif"></td><td><font size="5"><b>Air Fare</b></align></font><br />
</td></tr><br />
</table><br />
<br />
<br />
I have many pages that start this way, with the word (in this case) 'Air Fare' being substituted with other words like Car Rental, Hotel, etc.<br />
<br />
However, none of the words in this top table seem to be centered in the same way, and the words appear to "jump" from side to side (slightly off-centered) as i click from page to page.<br />
<br />
Everything was centered find until i added the barn2.gif to the table.<br />
<br />
Any suggestions on how to fix the code so the text placement in this top table is consistent?<br />
<br />
Thanks in advance for the answer and/or pointing me in the right direction.<!--content-->in every td a center, that will work<!--content-->yup, replace alot of that with css:<br />
<br />
<style type="text/css"><br />
table.1 {width:100%;height:90%;background-color:#6699ff;}<br />
td.1 {text-align:left;width:100%;}<br />
h1.1 {text-align:center;font-size:12px;}<br />
</style><br />
<br />
<table class="1"><br />
<tr><td class="1"><img src=http://www.htmlforums.com/archive/index.php/"/images/barn2.gif><h1 class="1">Air Fare</h1></td></tr></table><br />
<br />
remember to put all your css into an external stylesheet :)<br />
<br />
/added<br />
<br />
you can also set the font family and color in css:<br />
font-family:verdana;color:#000000;<br />
go here (<!-- m --><a class="postlink" href="http://www.w3schools.com/css/css_font.asp">http://www.w3schools.com/css/css_font.asp</a><!-- m -->) to learn more :)<!--content-->Thanks to both of you...<br />
<br />
i tried making each <td> into <td align="center"> but it only moved the wordsmore to the right!<br />
<br />
<br />
I don't fully understand CSS (and did begin the turial link you provided) but when i tried the CSS suggestion the blue banner was HUGE, and the word "Air Fare" ended up below the banner. I even went back and tried to adjust the size 90% that you provided to 90 and/or 90px, but neither one of them did any good... "air fare" remained under the barn2.gif and the banner was BIG (from top to bottom)<br />
<br />
Any ideas what i could have done wrong, or perhaps another way to skin this cat?<br />
<br />
Thanks.<!--content-->OK, i messed around with it some more and i THINK i got it to work, using the following code:<br />
<br />
<table bgcolor="#6699FF" width="100%" height="90"><br />
<tr><td width="20%" align="center"><img WIDTH="100" HEIGHT="100" SRC=http://www.htmlforums.com/archive/index.php/"/images/barn2.gif"></td><td width="100%" align="center"><font size="5"><b>Hotel Links</b></font><br />
</td></tr><br />
</table><br />
<br />
<br />
I'll update again if i have any problems.<br />
<br />
Thanks for the help <again>. If i learned anything, i think it's that i need to get up on the CSS learning curve (but i'm only about 2 weeks into HTML, so everything in time!)<!--content-->yeah, changing the 90 should have changed the height, it was being pushed under because i used an h1, if i change the display to inle then it doesnt center, but try this instead:<br />
<br />
<style type="text/css"><br />
table.1 {width:100%;height:90;background-color:#6699ff;}<br />
td.1 {text-align:left;width:45%;}<br />
td.2 {text-align:left;width:55%;<br />
span.1 {text-align:center;font-size:12px;}<br />
</style><br />
<br />
<br />
<table class="1"><br />
<tr><td class="1"><img src=http://www.htmlforums.com/archive/index.php/"/images/barn2.gif"></td><td class="2"><span class="1">Air Fare</span></td></tr></table><!--content-->Leo,<br />
<br />
Thanks for the reply, but my prior post shows a solution i found that now seems to be working fine, so i'd rather not mess with it again ;) <br />
<br />
Unless of course you find something that's wrong with the code that i'm using as the "fix".<!--content-->Make sure that the <td> ... </td> tags are on the same line as the HTML code they enclose.<br />
<br />
<br />
The above examples did not do that; they had the closing </td> on a new line.<br />
<br />
<br />
Add alt="some text" to every <img > tag, the text reflecting what is in the dispayed image. On unimportant images, like spacer elements, a minimum of alt="" is fine. For bullet-point images, alt="*" is often used. Search engines do index the alt text. The alt attribute is a required element.<br />
<br />
<br />
Run the code through <!-- m --><a class="postlink" href="http://validator.w3.org/detailed.html">http://validator.w3.org/detailed.html</a><!-- m --> and fix all the problems it highlights.<!--content-->not at all thereuare,<br />
i posted at the same time you did, if i'd seen you had found a solution i wouldn't have posted :)<!--content-->
 
Back
Top