Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm trying to hide the overflow in CSS for specific template pages but can't seem to get it to work - I know that template pages are prefixed with a class but this doesn't seem to help targeting.

I think I could use the is_page_template() function to hide the overflow with JS but this should be simpler with CSS.

So this works...

html {
    overflow: hidden;
    }

but this doesn't work...

html .page-template-showreel-php {
    overflow: hidden;
    }

Any ideas why? Surely this should be possible with CSS.

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

This:

html .page-template-showreel-php {
    overflow: hidden;
    }

...will target body.page-template-showreel-php. So, two questions:

  1. Do you have the <?php body_class(); ?> template tag inside of the <body> HTML tag?
  2. Is hiding overflow on the <body> tag really what you're after, or do you need to target a descendant element?

EDIT

There is no semantic or programmatic reason that you can't re-use the <?php body_class(); ?> template tag inside the <html> tag also. So, you might consider:

<html <?php body_class(); ?>>

and then:

html.page-template-showreel-php {
    overflow: hidden;
}

Worth a shot...

share|improve this answer
    
Hi Chip.. 1. Yes 2. What I am trying to achieve is hide the vertical scrollbar completely on the page. Normally I would just use html {overflow:hidden;} but in this case I only want to target a template page. Here is a link to help conceptualise what I'm trying to do... www.jaygeorge.co.uk/gwennan-sage/showreels The vertical scrollbar should be hidden because it's distracting and I would like the page to be button driven considering my target audience (non-web-savvy people who prefer clicking buttons over scrolling) –  SparrwHawk Jun 25 '11 at 20:40
    
See answer update... –  Chip Bennett Jun 25 '11 at 20:54
    
Hi Chip, That works great, thanks a lot. If you refresh jaygeorge.co.uk/gwennan-sage/showreels you can see your code working. Cheers, Jay –  SparrwHawk Jun 25 '11 at 21:14
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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