Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

overflow:auto not working

Status
Not open for further replies.

TheConeHead

Programmer
Aug 14, 2002
2,106
US
Why is this not working, it streches the div as big as the content:

Code:
results {overflow:auto; height:100; width:560; font-size:5pt;}

<div class="results">
asdgasdgasdg<br>asdgasdgasdg<br>asdgasdgasdg<br>
asdgasdgasdg<br>asdgasdgasdg<br>asdgasdgasdg<br>
asdgasdgasdg<br>asdgasdgasdg<br>asdgasdgasdg<br>
asdgasdgasdg<br>asdgasdgasdg<br>asdgasdgasdg<br>
asdgasdgasdg<br>asdgasdgasdg<br>asdgasdgasdg<br>
asdgasdgasdg<br>asdgasdgasdg<br>asdgasdgasdg<br>
</div>

[conehead]
 

If you want the content to truncate instead of the container to stretch, you should use "overflow:hidden".

Hope this helps,
Dan
 
I want the container to maintain a hard height and have scrollbars when the content is too long...

I'll try hidden

[conehead]
 
ok - it's official - I'm a moron

Code:
[b][COLOR=#ff0000].[/color][/b]results {overflow:auto; height:100; width:560; font-size:5pt;}

[conehead]
 
a) you need a "." before the "results" in your style sheet
b) you need a complete doctype
c) you need units (px, em) for height and width

Should look more like this:

Code:
.results {
  overflow: auto;
  height: 100px;
  width: 560px;
  font-size: 5pt;
}

<div class="results">
asdgasdgasdg<br>asdgasdgasdg<br>asdgasdgasdg<br>
asdgasdgasdg<br>asdgasdgasdg<br>asdgasdgasdg<br>
asdgasdgasdg<br>asdgasdgasdg<br>asdgasdgasdg<br>
asdgasdgasdg<br>asdgasdgasdg<br>asdgasdgasdg<br>
asdgasdgasdg<br>asdgasdgasdg<br>asdgasdgasdg<br>
asdgasdgasdg<br>asdgasdgasdg<br>asdgasdgasdg<br>
</div>

Additionally, "pt" is more for printing. I'm not even sure it's a valid CSS unit. You should use pixels or ems.

*cLFlaVA
----------------------------
"Holy crip he's a crapple!
 
Additionally, "pt" is more for printing. I'm not even sure it's a valid CSS unit. You should use pixels or ems.

"pt" (points) can be used for either screen or print media, and is perfectly acceptable, AFAIK.

In fact, I belive the following are all good:

em, ex, pt, px, %

Hope this helps,
Dan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top