2

Until recently, my website was following proper semantic standards with H1 tags before H2 and H3 tags.

Now, on my site I was asked to put an advertisement of a festival for the owner at the top of the page before any page content.

The advertisement itself coding wise contains a DIV tag and in that contains an H3 tag for a title and paragraphs of text and an image, but the advertisement has no relation to the site.

The coding in rough form for the advertisement looks like this:

<div><h3>Advertisement title</h3><p>Advertisement detailed text information</p></div>

And the site coding in rough form excluding the head section of html and body tags looks like this:

<h1>Title of page</h1><h2>Subtitle</h2><p>Main page content</p>

But when I add the advertisement at the top of the page as requested by the owner, the sample code on my page looks something like this:

<div><h3>Advertisement title</h3><p>Advertisement detailed text information</p></div>
<h1>Title of page</h1><h2>Subtitle</h2><p>Main page content</p>

This in turn violates standards as H3 precedes H1 and H2.

How could I best solve this in a standard way while still giving some emphasis to the advertisement? I was thinking replacing the H3 tag with a P tag and styling it but I'm not sure if that is sufficient to meet standards such as google's (or any other search engines) webmaster quality guidelines.

  • It is okay to have an h3 tag at the top. It is best not to, but the upshot is that just one will not hurt. The big concern I have is that it could be seen as content and seriously skew your SEO efforts. – closetnoc Aug 21 '15 at 22:23
  • Which HTML version do you use? – unor Aug 21 '15 at 23:56
  • I use and comply with 4.01 strict – Mike Aug 22 '15 at 0:34
1

One option is to put the advert at the end of your HTML (probably just before </body>) and position it at the top with CSS.

Something along the lines of

#advertisement {
    position: absolute;
    top: 0;
    height: 120px;
}
body {
    padding-top: 120px;
}

It will probably need more than that but that should give you an idea.

  • Doesn't that violate google's adsense policies since the ad shifts during loading phase? – Mike Sep 21 '15 at 19:09
  • I wouldn't say so. I don't know if the policies have changed because I see a lot of people saying this but I've read through the adsense policies again recently and although it does limit where you can place ad units I can't find anything about simply moving ad units. So as long as you aren't concealing content or artificially generating clicks etc. you should be fine. – Cai Sep 21 '15 at 20:36
  • Also, using CSS positioning is a perfectly normal way of layout out web pages. If CSS positioning counts as shifting something on load then every element on your page is shifting on load! – Cai Sep 21 '15 at 20:36
0

Use CSS, copy the class you're currently applying to H3 and then reproduce it in a custom class and apply it to the advertisement in a

or any other element different than a heading.

0

My advice is to go for the solution CAI gave you and not to waste heading on that, you can store the ad in every block element that pops up your mind it could be em it could be p it could be anything, and positioning it with CSS makes perfect sence.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.