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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cant Get Text To Center 1

Status
Not open for further replies.

telebofh

ISP
Oct 10, 2002
8
0
0
US
I cant seem to figure out why the text (the word gallery) wont center. I have tryed several different code lines and none of them seem to work. Any suggestions would be appreicated!
------------------------------------------------------------
<html>
<head>

<style type=&quot;text/css&quot;>
td.g {font-family : Garamond; border-style : solid; border-color : #000000;}
td.gg {font-family : Palatino Linotype; border-style : solid; border-color : #000000; text-align : center; background-color : #ffffbb;}
</style>

</head>




<table border=&quot;1&quot; width=&quot;100&quot; cellspacing=&quot;2&quot; cellpadding=&quot;2&quot; height=&quot;79&quot; bordercolor=&quot;#000000&quot;>
<tr>
<td class=&quot;gg&quot; width=&quot;73&quot; height=&quot;21&quot;>
Gallery
</td>
</tr>
<tr>
<td class=&quot;g&quot; width=&quot;73&quot; height=&quot;58&quot; valign=&quot;top&quot; align=&quot;left&quot;>
<a href=&quot;&quot;>Personal</a><br>
<a href=&quot;&quot;>Odd</a><br>
<a href=&quot;&quot;>Forum</a><br>
</td>
</tr>
</table>
<br>





</body>
</html>
 
Hi,

In your css dont have a space between text-align and the :

Have you also tried these 2 methods:
<td class=&quot;gg&quot; width=&quot;73&quot; height=&quot;21&quot; align=&quot;center&quot;>
Gallery
</td>

or

<td class=&quot;gg&quot; width=&quot;73&quot; height=&quot;21&quot;>
<center>Gallery</center>
</td>

Try those out and it should work. Probab;y just the space in your CSS or you are using a browser that doesn't recognize text-align.

Hope this helps!
relax.gif

 
Sorry if that first part seems confusing.

Should say:
In your css dont have a space between &quot;text-align&quot; and the &quot;semi-colon&quot; ---> (text-align: center)

Hope this helps!
relax.gif

 
First of all, I don't think that align is official anymore.
Second, the extra space shouldn't affect anything.
-----------------------
Ok. I figured this out.
The problem is that the width of the table was set to 100px, making the cell width that much, but the cell was told to only go 73px, so the content centered, only with a smaller width, making it appear to the left of the center. Change either the width of the cell or of the table and it will work (with the same css you used).

Rick
 
Spot on Rick,
Just delete the widths from the <td> tags as the table is going to be 100px wide anyway. Soon as you do that it'll pop right into the centre.

Pete
 
Awesome, didn't even see that, thanks!

1 more question if yall dont mind:
-----------------------------------------------------------
I'm just starting to learn CSS and I just about got a grasp of most stuff but what I cant figure out (if it is possible) is to make tables in the external style sheets.

I basically have a webpage where only the main content changes (center of page) and all the surrounding data will remain consistent through out the website.

If possible I would like to put this in an external sheet for obvious reasons.

I searched the web for 2 days but came up empty handed. Any info I can get would be much appreciated, thanks!
 
Dont know if you can do it just with CSS. I'd use an <iframe> to display what you need, but thats a personal choice, some people dont like em.


----------------------------------->>>
<td width=&quot;100%&quot; align=&quot;center&quot;>
<iframe name=&quot;whatever&quot; width=&quot;100%&quot; height=&quot;100%&quot;
src=&quot;content.html&quot; scrolling=&quot;auto&quot; frameborder=&quot;0&quot;>Your browser does not support frames.
</iframe>
</td>

<a href=&quot;link.html target=&quot;whatever&quot;>Link</a>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top