Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Apr 2011
    Posts
    19
    Thanks
    5
    Thanked 0 Times in 0 Posts

    Question Help with overflow:scroll

    Having real trouble with the overflow:scroll attribute with IE. My problem only persists in IE and works as intended in FF/Chr/Saf.

    <html>
    <head>
    </head>

    <body>

    View this page in Firefox and the red border will sit outside the black border (as it's supposed to).
    View this page in IE and due to "overflow:scroll" the red border sits inside the black border (the problem).

    <p><div id="theDiv" style="border: 1px solid black; width:200px; height: 50px; overflow: scroll"></div>

    <script type="text/javascript">
    var ih = '<div style="position: absolute; width: 100%; height: 500px; border: 5px solid red; top: 0px; left: 0px"></div>';
    document.getElementById("theDiv").innerHTML = ih;
    </script>

    </body>
    </html>

    Any help to resolve this would be hugely appreciated.

  • #2
    Regular Coder COBOLdinosaur's Avatar
    Join Date
    Jul 2002
    Location
    Canada
    Posts
    411
    Thanks
    2
    Thanked 32 Times in 32 Posts
    Well there are issues with support of scroll in IE related to doctype. Without a link to a real page where we can see what is affecting the element, it is not possible to give any definitive solution.
    100% standards compliant code is 100% correct 100% of the time.
    one of my toys from my repository and perhaps some help getting help

    Cd&

  • Users who have thanked COBOLdinosaur for this post:

    danielnz (02-07-2013)

  • #3
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,675
    Thanks
    22
    Thanked 1,827 Times in 1,811 Posts
    Hello danielnz,
    Like COBOLdinosaur said, it's important to have a DocType declaration. See the link in my signature about DocTypes.

    test your code with a Strict DocType like this -
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitled Document</title>
    </head>
    <body>
        <p>
            View this page in Firefox and the red border will sit outside the black border (as it's supposed to). 
            View this page in IE and due to "overflow:scroll" the red border sits inside the black border (the problem).
        </p>
    		<div id="theDiv" style="border: 1px solid black; width:200px; height: 50px; overflow: scroll"></div>
    	<script type="text/javascript">
    		var ih = '<div style="position: absolute; width: 100%; height: 500px; border: 5px solid red; top: 0px; left: 0px"></div>';
    		document.getElementById("theDiv").innerHTML = ih;
        </script>
    </body>
    </html>
    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

  • Users who have thanked Excavator for this post:

    danielnz (02-07-2013)

  • #4
    New Coder
    Join Date
    Apr 2011
    Posts
    19
    Thanks
    5
    Thanked 0 Times in 0 Posts
    Problem solved! Thanks. Didn't even consider the DOC type to be the problem.


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •