i want the logo in the center. <!-- logo --> <a name="top"></a> <table border="0" width="$stylevar[outertablewidth]" cellpadding="0" cellspacing="0" align="center"> <tr> <td align="$stylevar[left]"><a href="$vboptions[forumhome].php$session[sessionurl_q]"><img src="$stylevar[titleimage]" border="0" alt="$vboptions[bbtitle]" /></a></td> <td align="$stylevar[right]" id="header_right_cell"> <if condition="$ad_location['ad_header_logo']">$ad_location[ad_header_logo]<else /> </if> </td> </tr> </table> <!-- /logo --> Code (markup):
<table align="center" border=...........................the rest of that Or if you have some text and you just want the image centered <p align="center"> <img tag> </p> Neither will validate. Both will work.
It is working here for me. I don't have the logo so all I am seeing is a broken image link in the header of a page and it on an html page not a php page and I don't have a css file that might be messing with it. Do you have it live somewhere? What exactly are you trying to do? Have a logo and an add in the header? One or the other?
Uhm, if you aren't going to have more than one TR, why are you using a table? On top of which it looks like you are trying to control something from a ton of scripted variables that should be controlled from the CSS. AND applying your width manually when a perfectly good containing DIV should handle that. <div id="logo"> <a href="$vboptions[forumhome].php$session[sessionurl_q]" class="logolink"> $vboptions[bbtitle] <span></span> </a> <div class="advert"> <if condition="$ad_location['ad_header_logo']">$ad_location[ad_header_logo]</if> </div> <!-- #logo --></div> Code (markup): Everything else being done there should be in the stylesheet.... and I'm not 100% certain, but I have the feeling if I was coding it that would be the page's h1, not a DIV, without an ID. You're generating presentational markup - something that should have gone the way of the dodo when HTML4/CSS2 were finalized over a decade ago, and CAN go the way of the dodo since all the latest browsers are on-board for proper separation of presentation from content. Oh, that empty span is where I'd load the image. #logo .logolink span would target it. You set the anchor to display:block, set the same dimensions as the image, make sure the text stays inside that image, then absolute position the span over the text - that way images off the user has something to look at apart from ugly alt text, search engines see real content (since they ignore attributes like alt), and you can easily reskin the page without digging into the markup.
@deathshadow: if its working don't fix it. Why looking for something else if its working. If <center></center> is the solution use it.
Not the solution in strict doctypes since that's invalid markup, and it was deprecated for a reason. That is presentation, presentation does not go in the markup unless you are stuck using decade old coding techniques that were a bad idea THEN. HTML should as much as possible say what things are, NOT how they appear. Which is why you see rubbish websites with code to text ratios of 20:1 instead of 1:1. Nothing like serving 40k of markup for 2k of actual content. Tags like CENTER and FONT, along with attributes like ALIGN, BGCOLOR - that bullshit shouldn't even be taught anymore and nobody writing NEW websites should be using that malarkey as it's a decade or more out of date. All it does is bloat out the markup making it harder to maintain, not make full use of caching models across multiple pages on the same site, and defeats the entire point of modern markup separating content (HTML) from presentation (CSS)
yep I agree you shouldn't use it in strict markups but to come back to the topic I think setting this in the CSS for the logo div should put it in the middle I'm not sure tho. margin: 0 auto; margin-left:auto; margin-right:auto; Code (markup):
The latter two lines of that are redundant. Margin:0 auto; defines top and bottom as zero, left and right as auto - as such you don't need to say margin-left or margin-right.
Also redundant. You do not need to say a metric for zero, and the opposide side defaults to what is already set. The only reason to state all four sides like that is if they are DIFFERENT. GAH, BASIC CSS RULES PEOPLE!!! This is the EXACT same thing: margin:0 auto; That is all you need to say.