10 Replies - 80126 Views - Last Post: 07 September 2007 - 07:27 AM

#1 devangnegandhi   User is offline

  • New D.I.C Head
  • member icon

Reputation: 3
  • View blog
  • Posts: 40
  • Joined: 23-January 06

hide horizontal scrollbars

Posted 25 August 2007 - 11:26 PM

i m making a site and i want to hide my horizontal scrollbar but keep the vertical scrollbar of the browser....... is it possible??
Is This A Good Question/Topic? 0
  • +

Replies To: hide horizontal scrollbars

#2 Arbitrator   User is offline

  • D.I.C Addict
  • member icon

Reputation: 52
  • View blog
  • Posts: 530
  • Joined: 26-January 05

Re: hide horizontal scrollbars

Posted 26 August 2007 - 01:18 AM

View Postdevangnegandhi, on 26 Aug, 2007 - 01:26 AM, said:

i m making a site and i want to hide my horizontal scrollbar but keep the vertical scrollbar of the browser....... is it possible??
Use overflow: auto; overflow-x: hidden;. The first declaration is used to provide both scrollbars for browsers that donít support overflow-x; you can remove it if youíre trying to control scrollbars on the html or body elements rather than a lesser element like div.

This is supported in Firefox 2, Internet Explorer 6 and 7, and Safari 3 (beta). Itís not supported in Opera 9.
Was This Post Helpful? 1

#3 devangnegandhi   User is offline

  • New D.I.C Head
  • member icon

Reputation: 3
  • View blog
  • Posts: 40
  • Joined: 23-January 06

Re: hide horizontal scrollbars

Posted 27 August 2007 - 01:53 AM

thanks dude....
Was This Post Helpful? 0
  • +
  • -

#4 devangnegandhi   User is offline

  • New D.I.C Head
  • member icon

Reputation: 3
  • View blog
  • Posts: 40
  • Joined: 23-January 06

Re: hide horizontal scrollbars

Posted 27 August 2007 - 09:58 AM

but i am facing a prob.....its working fine for firefox but not IE......???
Was This Post Helpful? 0
  • +
  • -

#5 Arbitrator   User is offline

  • D.I.C Addict
  • member icon

Reputation: 52
  • View blog
  • Posts: 530
  • Joined: 26-January 05

Re: hide horizontal scrollbars

Posted 27 August 2007 - 10:09 AM

View Postdevangnegandhi, on 27 Aug, 2007 - 11:58 AM, said:

but i am facing a prob.....its working fine for firefox but not IE......???
Where is your code?
Was This Post Helpful? 0
  • +
  • -

#6 devangnegandhi   User is offline

  • New D.I.C Head
  • member icon

Reputation: 3
  • View blog
  • Posts: 40
  • Joined: 23-January 06

Re: hide horizontal scrollbars

Posted 27 August 2007 - 11:23 AM

i just used a javascript at the starting of my page which is - document.body.style.overflowX="hidden";

in firefox the horizontal scrollbar has disappeared but in IE it still shows....
Was This Post Helpful? 0
  • +
  • -

#7 Arbitrator   User is offline

  • D.I.C Addict
  • member icon

Reputation: 52
  • View blog
  • Posts: 530
  • Joined: 26-January 05

Re: hide horizontal scrollbars

Posted 27 August 2007 - 01:29 PM

View Postdevangnegandhi, on 27 Aug, 2007 - 01:23 PM, said:

i just used a javascript at the starting of my page which is - document.body.style.overflowX="hidden";

in firefox the horizontal scrollbar has disappeared but in IE it still shows....
It seems that Internet Explorer 6 does not support application of overflow-x to the body element as is required by the CSS2.1 CR. Apply it to the html element instead.

This doesn’t appear to be an issue in Internet Explorer 7, but that browser has another issue: when you set the property, most of the scrollbar is removed, but you can see pieces of it in the lower left and lower right corners of the window until you resize the window, scroll, or zoom in or out. It seems minor, but is something to consider.

Also note that the html element doesn’t have style or class attributes, so you need to resort to other methods of applying the declaration.

var d = document;
var dsS = d.styleSheets;
if (dsS[0].insertRule) dsS[0].insertRule("html { overflow-x: hidden; }", dsS[0].cssRules.length); // W3C DOM2 Style
else if (dsS[0].addRule) dsS[0].addRule("html", "overflow-x: hidden"); // Microsoft


Finally, I’m wondering why you’re doing this via scripting. I can’t think of any practical application for dynamically disabling window scrollbars. Maybe you could put the code directly into a style sheet?

This post has been edited by Arbitrator: 27 August 2007 - 01:32 PM

Was This Post Helpful? 0
  • +
  • -

#8 devangnegandhi   User is offline

  • New D.I.C Head
  • member icon

Reputation: 3
  • View blog
  • Posts: 40
  • Joined: 23-January 06

Re: hide horizontal scrollbars

Posted 27 August 2007 - 09:23 PM

thanks a lot man..... actually i ended up doing it in directly in style sheets only...... initially i was confused as i checked many ebooks, searched on the net and also used dreamweaver but none of them showed anything of html tag supporting overflow-x....... u solved everythin......thanks again

one more thing....do u know of any book or site which exactly shows all the css that can be used cause as far as i hav experienced till now, none are exact in what can be and what cannot be used.....
Was This Post Helpful? 0
  • +
  • -

#9 Warebear   User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 8
  • Joined: 06-September 07

Re: hide horizontal scrollbars

Posted 06 September 2007 - 08:17 AM

http://www.westciv.c...y/css_tutorial/
Was This Post Helpful? 0
  • +
  • -

#10 Arbitrator   User is offline

  • D.I.C Addict
  • member icon

Reputation: 52
  • View blog
  • Posts: 530
  • Joined: 26-January 05

Re: hide horizontal scrollbars

Posted 06 September 2007 - 01:55 PM

View Postdevangnegandhi, on 27 Aug, 2007 - 11:23 PM, said:

one more thing....do u know of any book or site which exactly shows all the css that can be used cause as far as i hav experienced till now, none are exact in what can be and what cannot be used.....
http://www.webdevout...er-support-css/ shows all of the CSS constructs available in the most mature CSS specifications, provides hyperlinks to those specifications, and shows browser support. Note that it doesnít include properties like overflow-x which appear in an unmature CSS3 specification (and was originally proprietary to Microsoft).

With regard to books, Cascading Style Sheets: A Definitive Guide seemed decent. I skimmed through it after I was already well‐informed with regard to CSS; it helped me understand absolute positioning, line‐height, floats, etc.
Was This Post Helpful? 0
  • +
  • -

#11 devangnegandhi   User is offline

  • New D.I.C Head
  • member icon

Reputation: 3
  • View blog
  • Posts: 40
  • Joined: 23-January 06

Re: hide horizontal scrollbars

Posted 07 September 2007 - 07:27 AM

k....thanks a lot!!
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1