Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

HTML - need to have a scrollbar even when the text stays within the alotted area

Options
  • 24-03-2007 7:32pm
    #1
    Closed Accounts Posts: 164 ✭✭


    I have 6 or 7 different pages on my site and all but one of them have vertical scrollbars because they contain too much text to be viewed without one. But because I have the text aligned as center in each page, the text on that one page that doesn't have a scrollbar, is slightly more to the right than on all the other pages. So what I want to do is to be able to program it so that even when a scrollbar is not required, a greyed out scrollbar will appear anyway. Is there a way of doing this?


Comments

  • Registered Users Posts: 8,488 ✭✭✭Goodshape


    Try using some CSS.

    I'm actually not too sure if this works (in a net cafe, can't test at the moment) but try adding style="overflow : yes" to your <body> tag.

    If that doesn't work, try style="min-height : 101%". This one's not perfect but it might be better than nothing.

    Also, IE will ignore the 'min-height' property - but AFAIR IE includes the grayed-out scrollbar anyway.


  • Closed Accounts Posts: 164 ✭✭defenstration


    Cheers but I'm already using CSS, and setting overflow to yes makes no difference. Here is what I currently have (before I used to have overflow set to auto):
    #CONTENT {
    position:absolute;
    top:154px;
    left:50%;
    margin-left:-367px;
    width:749px;
    height:71%;
    text-align:left;
    text-indent:40px;
    background:#FFFFFF;
    overflow:yes;
    }

    If I set the overflow to yes in my BODY, then it will show a greyed out scrollbar, but I only want the scrollbar on one of the style sheets and not the whole way down the full page.


  • Closed Accounts Posts: 164 ✭✭defenstration


    Here are the contents of my full STYLE tag. The CONTEN style sheet is the one that I want the greyed out scrollbar to appear in. What I thought might be the problem was that the CONTENT style sheet is contained in the CONTENTCONTAINER stylesheet, so I thought maybe that the overflow settings in CONTENTCONTAINER might be overwriting those in CONTENT, but no matter what I tried, I still could not get a greyed out scrollbar in CONTENT:

    <STYLE type="text/css">

    BODY {
    margin:0px;
    border:0;
    margin:0px;
    padding:0px;
    text:align:center;
    font-family:arial, verdana, sans-serif;
    font-size:0.8em;
    background:#000099;
    overflow:auto;
    }

    #HEADER {
    position:absolute;
    top:13px;
    left:0px;
    width:100%;
    height:90px;
    text-align:center;
    background:#FFFFFF;
    overflow:hidden;
    }

    #MENU {
    position:absolute;
    top:116px;
    left:50%;
    margin-left:-382px;
    width:764px;
    height:25px;
    text-align:center;
    background:#000099;
    overflow:hidden;
    }

    #CONTENTCONTAINER {
    position:absolute;
    top:154px;
    left:50%;
    margin-left:-382px;
    width:764px;
    height:71%;
    text-align:center;
    background:#FFFFFF;
    overflow:hidden;
    }

    #CONTENT {
    position:absolute;
    top:154px;
    left:50%;
    margin-left:-367px;
    width:749px;
    height:71%;
    text-align:left;
    text-indent:40px;
    background:#FFFFFF;
    overflow:yes;
    }

    </STYLE>


  • Registered Users Posts: 15,065 ✭✭✭✭Malice


    This is a solution that I use. The only problem is that you swap the horizontal scrolling for a 1 pixel vertical scroll instead. You may find it annoying :)

    In your .css file, add:
    height: 100%;
    	margin: 0px 0px 1px 0px;
    	padding: 0px;
    

    to both your HTML and BODY references. You can also take a shortcut by defining them both at once e.g.
    html, body
    {
       height: 100%;
       margin: 0px 0px 1px 0px;
       padding: 0px;
    }
    


  • Registered Users Posts: 15,065 ✭✭✭✭Malice


    Sorry, I should have previewed that a bit better. You actually only need to define these lines:
    height: 100%;
    margin-bottom: 1px;
    
    in the html reference of your .css file.


  • Advertisement
Advertisement