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 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Nov 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Internet Explorer - Content won't stay inside a div?

    Hello! I'm working on editing a profile on a website that I'm a member of and I'm having trouble making things look properly on IE.

    You should be able to see my profile without having to make an account:

    http://www.neopets.com/userlookup.phtml?user=katz640

    When I check it on FF, Chrome, Opera, and Safari, everything seems to look the way it should. However, when I look at it in IE, I notice that all the info doesn't go inside the #content div. It all just spills out into the #main div instead.

    I tried posting the whole site code, but it's too long! Sorry about that.

    Here's the portion with my CSS:

    Code:
    <style type="text/css">
    #header, #ban, #footer, hr, #ncmall, .contentModuleHeader, .contentModuleHeaderAlt {
    	display: none;
    }
    .contentModule {
    	border: none;
    }
    .contentModuleContent {
    	background: none;
    }
    .contentModuleTable {
    	border: none;
    }
    body {
    	background-color: #000000;
    }
    #main {
    	position: absolute;
    	top: 100px;
    	left: 0px;
    	padding-top: 20px;
    	padding-left: 10px;
    	width: 1000px;
    	height: 1000px;
    	border: 1px solid #FF0000;
    	background-color: transparent;
    }
    #content {
    	width: 650px;
    	height: 350px;
    	background-color: #FFFFFF;
    	overflow: hidden;
    }
    #a {
    	width: 620px;
    	height: 300px;
    	margin-left: -20px;
    	margin-top: 0px;
    	border: 1px solid #FF0000;
    	overflow: auto;
    }
    #userinfo {
    	position: relative;
    	top: 1000px;
    }
    #usercollections {
    	position: relative;
    	top: 1000px;
    }
    #userneopets {
    	position: relative;
    	top: 2000px;
    	width: 550px;
    }
    #usertrophies {
    	position: relative;
    	top: 3000px;
    	width: 650px;
    	height: 350px !important;
    	border: 1px solid #FF0000;
    	overflow: auto;
    }
    #usershop {
    	position: absolute;
    	top: 400px;
    	left: 10px;
    	height: 225px !important;
    	background-color: #FFF;
    }
    #usershop table {
    	width: 200px !important;
    	height: 200px !important;
    }
    #userneohome {
    	position: absolute;
    	top: 400px;
    	left: 235px;
    	width: 200px;
    	height: 200px;
    	background-color: #FFF;
    }
    #userneohome td {
    	width: 200px !important;
    	height: 200px !important;
    }
    #habitarium {
    	position: absolute;
    	top: 400px;
    	left: 460px;
    	height: 200px !important;
    	background-color: #FFF;
    }
    #habitarium table {
    	width: 200px !important;
    	height: 200px !important;
    }
    #l {
    	position: absolute;
    	top: 100px;
    	left: 675px;
    }
    #l a {
    	color: #FFF;
    	background: #CCC;
    	padding: 10px;
    	margin: 5px;
    	display: block;
    }
    #l a:hover {
    	background: #FD1;
    }
    </style>
    
    <div id="a">
    Under major construction.
    </div>
    <div id="l">
    <a href="#a">About Me</a>
    <a href="#userinfo">User Info</a>
    <a href="#userneopets">Neopets</a>
    <a href="#usertrophies">Trophies</a>
    <a href="/~Wizarmon">Portfolio</a>
    </div>
    Is there anything I could do to fix it? Thank you very much for your time.

  • #2
    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 katz640,
    You should not be using tables for anything you have here yet... tables are for tabular data. See the link about tables in my signature line below.

    Other than that, you put 1297px of stuff in #content but set the height on that element at 350px.
    You may not realize you style #content twice in your CSS, once from default.css and once again from embedded styles.

    Have a quick study of the box model.
    See the box model here. The box model says that whatever you put inside an element cannot be larger than that element. margin/padding/border all count when figuring width/height.

    Instead of giving #content a height, try making your CSS look like this -
    Code:
    /* Your mom... I mean, page content
    	#content {
    		width: 996px;
    		vertical-align: top;
    		clear: left;
    	}
    */
    
    #content {
    	width: 650px;
    	/*height: 350px;*/
    	background-color: #FFFFFF;
    	overflow: auto;
    }

    Of course, now there are other issues with the content of #content breaking the rules of the box model.

    The box model seems to be the hardest concept for new coders to grasp. You should study that a bit.
    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


  •  

    Posting Permissions

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