Go Back   CodingForums.com > :: Client side development > HTML & CSS

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-06-2012, 06:38 AM   PM User | #1
Rain Lover
Regular Coder

 
Join Date: Nov 2009
Posts: 138
Thanks: 9
Thanked 0 Times in 0 Posts
Rain Lover is an unknown quantity at this point
Box model: lost parent element scrollbar

The first sample shows scrollbars correctly:

Code:
<!DOCTYPE html>
<html>
<head>
<title></title>
<style type="text/css">
#parent {width:102px; height:101px; background:red; overflow:auto;}
#child {width:100px; height:100px; margin:1px; background:green;}
</style>
</head>
<body>
<div id="parent">
<div id="child"></div>
</div>
</body>
</html>
But the second doesn't:

Code:
<!DOCTYPE html>
<html>
<head>
<title></title>
<style type="text/css">
#parent {width:101px; height:102px; background:red; overflow:auto;}
#child {width:100px; height:100px; margin:1px; background:green;}
</style>
</head>
<body>
<div id="parent">
<div id="child"></div>
</div>
</body>
</html>
Why is that?
Thanks!

Last edited by Rain Lover; 11-06-2012 at 06:42 AM..
Rain Lover is offline   Reply With Quote
Old 11-06-2012, 01:12 PM   PM User | #2
stephen_
New Coder

 
Join Date: Jan 2012
Posts: 49
Thanks: 13
Thanked 0 Times in 0 Posts
stephen_ is an unknown quantity at this point
Use scroll on the overflow rather than auto?
http://www.w3schools.com/cssref/pr_pos_overflow.asp

Last edited by stephen_; 11-06-2012 at 01:18 PM..
stephen_ is offline   Reply With Quote
Old 11-06-2012, 05:47 PM   PM User | #3
Rain Lover
Regular Coder

 
Join Date: Nov 2009
Posts: 138
Thanks: 9
Thanked 0 Times in 0 Posts
Rain Lover is an unknown quantity at this point
Quote:
Originally Posted by stephen_ View Post
Use scroll on the overflow rather than auto?
http://www.w3schools.com/cssref/pr_pos_overflow.asp
Not the answer to my question.
Rain Lover is offline   Reply With Quote
Old 11-06-2012, 06:01 PM   PM User | #4
Excavator
Master Coder


 
Excavator's Avatar
 
Join Date: Dec 2006
Location: Alaska
Posts: 9,410
Thanks: 22
Thanked 1,765 Times in 1,749 Posts
Excavator has a spectacular aura aboutExcavator has a spectacular aura aboutExcavator has a spectacular aura about
Hello Rain Lover,
It's as if overflow: auto; does not recognize that 1px of margin as overflow, but only when it adds to the width. How weird is that?

I'm watching this thread to see if any of the smart guys on this forum have any idea what's going on.
__________________
Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
Use the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad
Excavator is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:41 AM.


Advertisement
Log in to turn off these ads.