/    Sign up×
Community /Pin to ProfileBookmark

Scrollbar Help (this is really, REALLY weird)

I’m asking for help because I did some testing today with div scrollbars using CSS, and something very strange happened.

The reason I was doing the test was the div scrollbar for my staff page wasn’t working in IE7, but that’s not the topic of this discussion (not the main one)

I made two divs in the test: an outer div and an inner div. No matter what I tried, in any browser I tried, I couldn’t get the scrollbar to work in the test. I sat there, trying to come up with some possible solution as to what I was doing wrong, when a strange thought occurred to me. I was trying to add a scrollbar to the INNER div. For experimentation purposes, I removed the scrollbar styling from the inner div and instead tried it on the outer div. It worked in BOTH IE7 and FF. For some reason, it wouldn’t work on the inner div, but it would work on the outer div.

Now, here’s where the weirdness occurs. The scrollbar for the div on my staff page doesn’t work in IE7, and the page is set up with an outer div and an inner div. The inner div scrollbar on my staff page WORKS in everything but IE7, yet when I was testing on my test page, the scrollbar wouldn’t work at all except on the outer div.

People, what’s going on?

to post a comment
CSS

7 Comments(s)

Copy linkTweet thisAlerts:
@gomisuteFeb 22.2008 — Sorry...what?

?

Read your own post...it's hard to follow...

post some code and may be we'll get it and help you.
Copy linkTweet thisAlerts:
@cootheadFeb 22.2008 — Hi there Joseph Witchard,

I assumed, as I read your post, that you had just stubbed out your [i]spliff[/i]. ?

So before igniting my [i]hubble bubble[/i] I knocked up this code for you...
[color=navy]
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">


<style type="text/css">
#outer {
width:324px;
height:200px;
border:1px solid #000;
overflow:auto;
margin:auto;
}
#inner {
width:298px;
height:400px;
padding:5px;
overflow:auto;
font-family:verdana,arial,helvetica,sans-serif;
font-size:12px;
text-align:justify;
}
#inner p {
text-indent:5px;
}
#inner p:first-letter {
font-family:serif;
font-size:150%;
color:#600;
}
</style>

</head>
<body>

<div id="outer">

<div id="inner">
<p>
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Cras volutpat, purus ac pellentesque
adipiscing, mauris ligula convallis metus, vitae scelerisque nibh orci quis mi. *** sociis natoque
penatibus et magnis dis parturient montes, nascetur ridiculus mus. Curabitur porttitor aliquam
libero. Quisque molestie ornare sem. Nam euismod sem lacinia ipsum. In pharetra metus ut dolor
cursus aliquam. Maecenas eu ante quis enim tincidunt laoreet. Pellentesque varius nunc in ipsum
pulvinar sollicitudin. Nunc et mi. Donec auctor dignissim orci. Aliquam sed magna. Pellentesque
in dui. In eget elit. Praesent eu lorem.
</p><p>
Cras cursus varius pede. Cras dolor lorem, convallis sed, venenatis ac, aliquam vitae, orci.
Duis diam massa, adipiscing quis, aliquam eget, ornare eu, lectus. Sed rutrum augue non purus.
Integer vel mauris. Nam suscipit molestie lectus. Fusce laoreet interdum eros. Pellentesque sit
amet enim id nunc adipiscing ultricies. Quisque lobortis eleifend elit. Sed eu augue sed felis
vulputate iaculis. Cras lorem felis, lobortis id, accumsan vel, facilisis quis, dolor. Curabitur
aliquet. Nulla facilisi. Proin nunc velit, posuere sit amet, porttitor et, volutpat a, massa.
Maecenas elementum volutpat justo. Pellentesque magna neque, dictum id, rhoncus a, fringilla et,
nulla. Phasellus placerat gravida purus. Pellentesque odio. Sed volutpat vehicula nulla. Quisque
metus urna, semper eget, aliquam ac, feugiat nec, massa.
</p><p>
</div>

</div>

</body>
</html>
[/color]

?

[i]coothead[/i]
Copy linkTweet thisAlerts:
@Joseph_WitchardauthorFeb 22.2008 — Hi there Joseph Witchard,

I assumed, as I read your post, that you had just stubbed out your [i]spliff[/i]. ?

So before igniting my [i]hubble bubble[/i] I knocked up this code for you...
[color=navy]
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">


<style type="text/css">
#outer {
width:324px;
height:200px;
border:1px solid #000;
overflow:auto;
margin:auto;
}
#inner {
width:298px;
height:400px;
padding:5px;
overflow:auto;
font-family:verdana,arial,helvetica,sans-serif;
font-size:12px;
text-align:justify;
}
#inner p {
text-indent:5px;
}
#inner p:first-letter {
font-family:serif;
font-size:150%;
color:#600;
}
</style>

</head>
<body>

<div id="outer">

<div id="inner">
<p>
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Cras volutpat, purus ac pellentesque
adipiscing, mauris ligula convallis metus, vitae scelerisque nibh orci quis mi. *** sociis natoque
penatibus et magnis dis parturient montes, nascetur ridiculus mus. Curabitur porttitor aliquam
libero. Quisque molestie ornare sem. Nam euismod sem lacinia ipsum. In pharetra metus ut dolor
cursus aliquam. Maecenas eu ante quis enim tincidunt laoreet. Pellentesque varius nunc in ipsum
pulvinar sollicitudin. Nunc et mi. Donec auctor dignissim orci. Aliquam sed magna. Pellentesque
in dui. In eget elit. Praesent eu lorem.
</p><p>
Cras cursus varius pede. Cras dolor lorem, convallis sed, venenatis ac, aliquam vitae, orci.
Duis diam massa, adipiscing quis, aliquam eget, ornare eu, lectus. Sed rutrum augue non purus.
Integer vel mauris. Nam suscipit molestie lectus. Fusce laoreet interdum eros. Pellentesque sit
amet enim id nunc adipiscing ultricies. Quisque lobortis eleifend elit. Sed eu augue sed felis
vulputate iaculis. Cras lorem felis, lobortis id, accumsan vel, facilisis quis, dolor. Curabitur
aliquet. Nulla facilisi. Proin nunc velit, posuere sit amet, porttitor et, volutpat a, massa.
Maecenas elementum volutpat justo. Pellentesque magna neque, dictum id, rhoncus a, fringilla et,
nulla. Phasellus placerat gravida purus. Pellentesque odio. Sed volutpat vehicula nulla. Quisque
metus urna, semper eget, aliquam ac, feugiat nec, massa.
</p><p>
</div>

</div>

&lt;/body&gt;[CODE][/CODE]</CODE>
&lt;/html&gt;<br/>
[/color]


?

[i]coothead[/i][/QUOTE]


The problem with that is I don't need the outer div to have a scrollbar?

gomisute, what I'm basically saying is this: on two different pages, I have two divs (two on each page), like this:

[CODE]<div id="outerDiv">
<div id="innerDiv">
content...
</div>
</div>[/CODE]


On one of my pages, I can't get a scrollbar to work for the inner div; I can only get it to work for the outer div. However, on another page, the scrollbar for the inner div works just fine. Both pages are set up exactly the same.
Copy linkTweet thisAlerts:
@cootheadFeb 22.2008 — Hi there Joseph Witchard,

Post a link to the site rather than a snip or meaningless code. ?

How on earth to you expect us look at...
[color=navy]&lt;div id="outerDiv"&gt;
&lt;div id="innerDiv"&gt;
content...
&lt;/div&gt;
&lt;/div&gt;[/color]

...and be able to make constructive comment on scrollbars or their absence. ?

Alternatively you could try this code....
[color=navy]
&lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd"&gt;
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;&lt;/title&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"&gt;


&lt;style type="text/css"&gt;
#outer {
width:314px;
height:190px;
padding:5px;
border:1px solid #000;
background-color:#ccf;
overflow:hidden;
margin:auto;
}
#inner {
height:179px;
padding:5px;
border:1px solid #000;
background-color:#fff;
overflow:auto;
font-family:verdana,arial,helvetica,sans-serif;
font-size:12px;
text-align:justify;
}
#inner p {
text-indent:5px;
}
#inner p:first-letter {
font-family:serif;
font-size:150%;
color:#600;
}
&lt;/style&gt;

&lt;/head&gt;
&lt;body&gt;

&lt;div id="outer"&gt;

&lt;div id="inner"&gt;
&lt;p&gt;
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Cras volutpat, purus ac pellentesque
adipiscing, mauris ligula convallis metus, vitae scelerisque nibh orci quis mi. *** sociis natoque
penatibus et magnis dis parturient montes, nascetur ridiculus mus. Curabitur porttitor aliquam
libero. Quisque molestie ornare sem. Nam euismod sem lacinia ipsum. In pharetra metus ut dolor
cursus aliquam. Maecenas eu ante quis enim tincidunt laoreet. Pellentesque varius nunc in ipsum
pulvinar sollicitudin. Nunc et mi. Donec auctor dignissim orci. Aliquam sed magna. Pellentesque
in dui. In eget elit. Praesent eu lorem.
&lt;/p&gt;&lt;p&gt;
Cras cursus varius pede. Cras dolor lorem, convallis sed, venenatis ac, aliquam vitae, orci.
Duis diam massa, adipiscing quis, aliquam eget, ornare eu, lectus. Sed rutrum augue non purus.
Integer vel mauris. Nam suscipit molestie lectus. Fusce laoreet interdum eros. Pellentesque sit
amet enim id nunc adipiscing ultricies. Quisque lobortis eleifend elit. Sed eu augue sed felis
vulputate iaculis. Cras lorem felis, lobortis id, accumsan vel, facilisis quis, dolor. Curabitur
aliquet. Nulla facilisi. Proin nunc velit, posuere sit amet, porttitor et, volutpat a, massa.
Maecenas elementum volutpat justo. Pellentesque magna neque, dictum id, rhoncus a, fringilla et,
nulla. Phasellus placerat gravida purus. Pellentesque odio. Sed volutpat vehicula nulla. Quisque
metus urna, semper eget, aliquam ac, feugiat nec, massa.
&lt;/p&gt;&lt;p&gt;
&lt;/div&gt;

&lt;/div&gt;

&lt;/body&gt;
&lt;/html&gt;
[/color]

[i]coothead[/i]
Copy linkTweet thisAlerts:
@Joseph_WitchardauthorFeb 23.2008 — How on earth to you expect us look at...

Code:

[CODE]<div id="outerDiv"> <div id="innerDiv"> content... </div> </div>[/CODE]

...and be able to make constructive comment on scrollbars or their absence.[/QUOTE]


Because what I posted was pretty straight forward? lol

Anyway:

http://www.uhrebirth.com/DTD_Test.php

http://www.uhrebirth.com/staff.php

The top link is the page where the scrollbar doesn't render in the inner div. The bottom link will take you to the page where the scrollbar on the inner div works just fine.
Copy linkTweet thisAlerts:
@CentauriFeb 23.2008 — On the first link, the content of the inner #test div is not high enough to invoke the scrollbars, but the extra <br>s, div and ad content that comes after the inner div is high enough to invoke the scrollbars on the outer #center div. If there is more content within #test, then it will have scrollbars.

How on earth do you expect any of this to render similar crossbrowser without a valid doctype and encodng specified?
Copy linkTweet thisAlerts:
@Joseph_WitchardauthorFeb 23.2008 — On the first link, the content of the inner #test div is not high enough to invoke the scrollbars, but the extra <br>s, div and ad content that comes after the inner div is high enough to invoke the scrollbars on the outer #center div. If there is more content within #test, then it will have scrollbars.

How on earth do you expect any of this to render similar crossbrowser without a valid doctype and encodng specified?[/QUOTE]


I use the non-standard scrolling marquee tag on my site. Up until a few days ago, I didn't know you could use non-standard HTML with a doctype and still have it work. I just haven't gotten a chance yet to add a doctype to all of my pages?
×

Success!

Help @Joseph_Witchard spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.8,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...