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 5 of 5
  1. #1
    Senior Coder effpeetee's Avatar
    Join Date
    Feb 2007
    Location
    Clapham Junction - London SW
    Posts
    4,885
    Thanks
    228
    Thanked 204 Times in 203 Posts

    Exclamation I STILL want to know the reason why it worked.

    This program was modified by me to make it work on IE7 and FFox 2..
    I have highlighted the code that I added to make it work. The trouble is that I don't know why it worked. I just messed about until it did. The result was OK but I learned nothing. Anybody that can, will they please explain why.

    Frank.

    Originally from. http://codingforums.com/showthread.php?t=128820

    Can be found on my site at-

    http://www.exitfegs.co.uk/Box%20test.html

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
       "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html>
    <head>
    <title>Box test</title>
    <style type="text/css">
    
    
    
    .headline_bg {
    clear:both;
        float:left;
    	background: #E8EFF6;
    	width:440px;
        height:40px;
    }
    
    .dotted {clear:both;
    position:relative;
        float:left;
    	background: #ccc;
    	width:440px;
        height:20px;
    }
    
    .datebox {
       position:absolute;
        display:inline;
        background: #ff00CC;
    	margin-left:7px;
    	width:53px;
        height:60px;
    }
    
    .clear {
    clear:left;
    }
    </style>
    </head>
    
    <body>
    <br />
    <br />
    <p>Make this</p>
    <div class="headline_bg"></div>
    <div class="dotted"></div>
    <div class="datebox"></div>
    <br class="clear"/>
    <p>Like this...</p>
    <img src="im.jpg">
    
    
    </body>
    </html>
    Last edited by effpeetee; 12-02-2007 at 08:19 PM.
    * Sources (updated: 21.11.2012.
    Using Windows 8 Professional. 64bit with HP Photosmart 5510 printer Very useful site here.

  • #2
    Senior Coder coothead's Avatar
    Join Date
    Jan 2004
    Location
    chertsey, a small town 25 miles south west of london, england.
    Posts
    1,706
    Thanks
    0
    Thanked 235 Times in 230 Posts
    Hi there Frank,

    I do not know why your method works, all I know is that I would not do it like that.

    This is How I would approach the problem...
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
       "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
    <title>Box test</title>
    <base href="http://www.exitfegs.co.uk/">
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    
    <style type="text/css">
    #make {
        margin-top:60px;
     }
    #headline_bg {
        float:left;
        background-color:#E8EFF6;
        width:440px;
        height:40px;
    }
    #dotted {
        clear:both;
        float:left;
        background-color:#ccc;
        width:440px;
        height:20px;
    }
    #datebox {
        background-color:#f0c;
        margin-left:447px;
        width:53px;
        height:60px;
    }
    </style>
    
    </head>
    <body>
    
    <p class="make">Make this</p>
    
    <div class="headline_bg"></div>
    <div class="dotted"></div>
    <div class="datebox"></div>
    
    <p>Like this...</p>
    
    <div><img src="im.jpg" alt=""></div>
    
    </body>
    </html>
    
    coothead

  • #3
    Senior Coder effpeetee's Avatar
    Join Date
    Feb 2007
    Location
    Clapham Junction - London SW
    Posts
    4,885
    Thanks
    228
    Thanked 204 Times in 203 Posts
    Hi!

    Yes, I probably would have done it differently, but one or two others had already given the original poster advice and I was just messing about with CSVista to see if I could find out what worked, and the result on my site was the outcome. I just don't know why it worked. Why did FFox not like the original which worked fine on IE, and what did the fresh code do that made the difference.
    My CSS is very basic, I have always done everything in the past with Markup.
    But I am inquisitive and don't like working blind. Still, until we get some reliable and consistent browsers; we shall get these problems I suppose.

    Thanks for the code. I will study it and hopefully learn from it.

    EDIT, I have tried the code but I cannot get it to work.
    It shows the im.jpg but not the div product.

    Regards,

    Frank
    Last edited by effpeetee; 12-02-2007 at 05:40 PM.
    * Sources (updated: 21.11.2012.
    Using Windows 8 Professional. 64bit with HP Photosmart 5510 printer Very useful site here.

  • #4
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,675
    Thanks
    22
    Thanked 1,827 Times in 1,811 Posts
    And, as usual, the answer is very simple and right in front of you. Good job coothead
    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

  • #5
    Senior Coder effpeetee's Avatar
    Join Date
    Feb 2007
    Location
    Clapham Junction - London SW
    Posts
    4,885
    Thanks
    228
    Thanked 204 Times in 203 Posts
    I've got a first "class" IDea.

    (My eyesight is not very good.)

    Frank

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
       "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
    <title>Box test</title>
    <base href="http://www.exitfegs.co.uk/">
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    
    <style type="text/css">
    #make {
        margin-top:60px;
     }
    #headline_bg {
        float:left;
        background-color:#E8EFF6;
        width:440px;
        height:40px;
    }
    #dotted {
        clear:both;
        float:left;
        background-color:#ccc;
        width:440px;
        height:20px;
    }
    #datebox {
        background-color:#f0c;
        margin-left:447px;
        width:53px;
        height:60px;
    }
    </style>
    
    </head>
    <body>
    
    <p id="make">Make this</p>
    
    <div id="headline_bg"></div>
    <div id="dotted"></div>
    <div id="datebox"></div>
    
    <p>Like this...</p>
    
    <div><img src="im.jpg" alt="Where has it gone?"></div>
    
    </body>
    </html>
    Last edited by effpeetee; 12-02-2007 at 06:52 PM.
    * Sources (updated: 21.11.2012.
    Using Windows 8 Professional. 64bit with HP Photosmart 5510 printer Very useful site here.


  •  

    Posting Permissions

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