Welcome to WebmasterWorld Guest from 54.160.198.60

Forum Moderators: incrediBILL

Message Too Old, No Replies

W3C Validation for a Centered Google Ad

     
11:50 pm on Oct 31, 2011 (gmt 0)

New User

joined:Oct 31, 2011
posts: 1
votes: 0


Hello there,

Is anyone having problems with the W3C validation?
It is being a bit annoying now.
Can anyone explain to me how to center a Google Add in a module, part of a CMS, with script tags without getting penalized by the W3C scheme?

Note that you can not use <center>, <div> and <p>

cheers
JC
10:31 am on Nov 1, 2011 (gmt 0)

Senior Member

WebmasterWorld Senior Member penders is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:July 3, 2006
posts: 3123
votes: 0


The <center> tag is deprecated (since it is presentational) and <p> can only contain certain other elements since it is primarily intended for a paragraph of text. The <div> element is probably the one to go for, but it will depend on the context where it is to be used. You might even be able to center the Goodle-Ad using existing elements?

You could perhaps post the resulting markup to see what we have to work with, but I suspect this is more of a CSS issue than an HTML one?
6:25 pm on Nov 1, 2011 (gmt 0)

Senior Member

WebmasterWorld Senior Member rocknbil is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Nov 28, 2004
posts:7999
votes: 0


Wrap it in a div, as mentioned, with margin:auto? text-align:center is likely to give you grief as that is, of course, for text and inline elements 9it will center things inside it you may not want centered.)
10:07 pm on Nov 3, 2011 (gmt 0)

Junior Member

joined:Oct 19, 2011
posts: 52
votes: 0


Put the entire ad script within a div and make the div align center. if you want to add the script through a cms just click on the source code and then add a div into it.
10:12 pm on Nov 3, 2011 (gmt 0)

Full Member

10+ Year Member

joined:Oct 15, 2005
posts: 326
votes: 0


I recently had issues getting a Google Maps iframe to validate and came up with the followig solution for XHTML 1.0 Strict validation:

<object style="width: 855px; height: 500px; border: 4px" data="http://example.co.uk/"></object>
4:05 pm on Nov 4, 2011 (gmt 0)

Senior Member

WebmasterWorld Senior Member rocknbil is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Nov 28, 2004
posts:7999
votes: 0


div align center


The align attribute is deprecated in HTML 4,5, and XHTML, along with <font>, <center>, and others. Margin:auto is usually a good substitute. It will still "work," it just won't validate.