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

Home Forums CSS showing a Div in the home page only ?

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

    hello everyone ..

    i’am trying to type a code that let me show a div only in the main page (index) , so if any visitors visits a second page .. the div will disappear.

    BTW i’am doing this on tumblr , so i guess there is an easy way to do it with some {block:thingy} code ?

    Jozsef K.

    HTML: <body id=”home”>

    CSS: #home .yourdiv {display:none}


    The body on the home page already has a class “home” by default.

    [EDIT: not true — see below.]

    So you could simply do this in your CSS:

    .somediv {display:none;}
    body.home .somediv {display:block;}


    unfortunately tumblr is using one templates , not a several pages .. so i can’t use this way because the body class will be applied to all of my blog pages , that’s mean it will appear in all the pages


    Hmm…. I thought it was a default setting for Tumblr to add the class “home” to the main page, but I just noticed that’s not the case. I looked at some old Tumblr thing I once did and it turns out that the home class was added with some nifty jQuery.

    OK well, try this then:


    This will only show on the index page.



    Senff i tried this code at the first , but for some reason it didn’t do the job

    and more ideas guys :( ?


    @7imaginary: strange — as it’s very basic Tumblr code. I just tried it in my very super basic theme and it does work:

    Jozsef K.

    Maybe your div has an inline style applied to it, like style=”display:none”


    any more suggestion guys ?


    i finally found the answer while searching :


    .page1 #box{

    Only displayed in first page.

    {CurrentPage} is a tumblr variable that’s hold the page number

    thank all of you guys for helping me :)

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