The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Page shifts when adding an ID to the body tag?

  • This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • #37190

    Hi yall!

    So i duplicated my index page and renamed it. Then i changed the id in the body tag from “home” to “featured” and now the featured page shifts?? WTF?

    Please Help! :l Thanks !

    #container {
    height: 790px;
    width: 1017px;
    margin-right: auto;
    margin-left: auto;
    position: relative;
    background-image: url(images/bg%20updated%207.jpg);
    background-position: center top;
    background-repeat: no-repeat;
    padding: 0px;
    margin-top: 0px;
    top: 0px;


    i fogot to paste the body tag


    It is probably because when you press the navfeatured link the browser thinks you want to focus on the element with id ‘featured’ due to the href attribute ‘featured.html’…
    My opinion is, you don’t need an id on body… Classes also don’t hurt…


    @xpy – why would a browser ‘think’ that? That’s not how hrefs work. It’s a link to a page – the browser goes to the page. The similarly named id has no bearing on it. To link to the id, the octothorpe would need to be in the href. And why not id the body? It’s a very powerful construct. Chris wrote an article on it, but its usefulness goes far beyond that.

    – how far of a shift is encountered? Are the two pages very different lengths? Do you have css for the body or #featured?


    @wolfcry911 – Are the two pages very different lengths?

    It’s most likely this.

Viewing 5 posts - 1 through 5 (of 5 total)
  • The forum ‘CSS’ is closed to new topics and replies.