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
    Regular Coder
    Join Date
    Oct 2008
    Posts
    255
    Thanks
    113
    Thanked 0 Times in 0 Posts

    IE and Opera Position Problems

    Code:
    <html>
    <head>
    <title>TESTING</title>
    <style type="text/css">
    body { color: #FFFFFF; font-size: 8pt; }
    
    #houses { width: 150px; height: 400px; text-align: center; }
    
    #g { width: 75px; height: 100px; float: left; background-image: url(gryffindorcopy.jpg); }
    
    #h { width: 75px; height: 100px; float: right; background-image: url(hufflepuffcopy.jpg); }
    
    #r { width: 75px; height: 100px; float: left; background-image: url(ravenclawcopy.jpg); }
    
    #s { width: 75px; height: 100px; float: right; background-image: url(slytherincopy.jpg); }
    
    p.houseText { position: relative; top: 71px; }
    
    <!--[if IE 8]>
    p.houseText { position: relative; top: 90px; }
    <![endif]-->
    </style>
    </head>
    <body>
    <div id="houses">
    <div id="g">
    <p class="houseText">100</p>
    </div>
    <div id="h">
    <p class="houseText">100</p>
    </div>
    <br/>
    <div id="r">
    <p class="houseText">100</p>
    </div>
    <div id="s">
    <p class="houseText">100</p>
    </div>
    </div>
    </body>
    </html>
    The background images are 75x100 pixels, as are their container divs. In Firefox and Chrome, the text is right below the hourglass, like I want it to be. In Opera and IE8, however, the text is positioned a little bit on top of the hourglasses. I don't know what to do about Opera, but I would have thought that the conditional comments would have fixed Internet Explorer. Maybe because it's IE 64 bit? I don't know.

    Does anyone have any ideas?

  • #2
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,672
    Thanks
    22
    Thanked 1,827 Times in 1,811 Posts
    Hello Joseph Witchard,
    Just a quick glance at your code and I'll bet IE would render a lot differently if you had a DocType Declaration.
    Check the link about DocTypes in my sig below.


    ...
    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

  • #3
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,672
    Thanks
    22
    Thanked 1,827 Times in 1,811 Posts
    I'm not sure what you want it to look like... but try 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>TESTING</title>
    <style type="text/css">
    body { 
    	background: #fc6; 
    	font-size: 8pt; 
    }
    #houses { 
    	width: 150px; 
    	height: 400px;
    	margin: 50px auto; /*just for presentation*/
    	background: #ccc;
    	text-align: center; 
    }
    #g, #h, #r, #s {
    	width: 75px; 
    	height: 100px; 
    	float: left; 
    }	
    #g{background: #ccc url(gryffindorcopy.jpg); }
    #h{background: #f00 url(hufflepuffcopy.jpg); }
    #r{background: #00f url(ravenclawcopy.jpg); }
    #s{background: #ff0 url(slytherincopy.jpg); }
    p.houseText { 
    	position: relative; 
    	top: 71px; 
    }
    </style>
    </head>
    <body>
        <div id="houses">
                <div id="g">
                    <p class="houseText">G100</p>
                </div>
            <div id="h">
                <p class="houseText">H100</p>
            </div>
                <div id="r">
                    <p class="houseText">P100</p>
                </div>
            <div id="s">
                <p class="houseText">S100</p>
            </div>
        <!--end houses--></div>
    </body>
    </html>
    That is going to put your p.housetext on top of the images, which may be what your wanting (not a clue what your hourglasses look like). If not, here is a demo of mine that shows one method of doing captions - image captions made easy
    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

  • #4
    Regular Coder
    Join Date
    Oct 2008
    Posts
    255
    Thanks
    113
    Thanked 0 Times in 0 Posts
    I already have in mind what I want it to look like. Thanks I always have a doctype declaration in the pages I publish to the web, but I never do for test pages, because I only keep them on my server while I'm testing. Won't do that anymore


  •  

    Posting Permissions

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