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.
Page 1 of 2 12 LastLast
Results 1 to 15 of 20
  1. #1
    Senior Coder xelawho's Avatar
    Join Date
    Nov 2010
    Posts
    2,981
    Thanks
    56
    Thanked 557 Times in 554 Posts

    does <div class ="x"> not need to be closed?

    Hi,

    this isn't really so much of a problem as just a question that is confusing me.

    I assume that using <div class ="x"> sets up a new div, so I have always closed it with a </div>

    but the validator tells me that I am closing a div that is not open.

    And when I wanted to nest an absolutely positioned div inside a floated left one, I changed this:

    Code:
    CSS:
    .control {
     font-family: Arial, Helvetica, sans-serif;
      	font-size:15px;
     float:left;
     margin:10px;
    }
    
     #results {
     z-index: 100;
    	font-family: Arial, Helvetica, sans-serif; 
    	background-color: white;
    	}
    
    HTML:
    <div class="control" id="results"> 
              <table id="featuretable">
                <tbody id="featuretbody">
                </tbody>
              </table>
    		</div>
    to this:

    Code:
    CSS:
    .control {
     font-family: Arial, Helvetica, sans-serif;
      	font-size:15px;
     float:left;
     margin:10px;
    }
    
     #results {
    position:absolute;
     z-index: 100;
    	font-family: Arial, Helvetica, sans-serif; 
    	background-color: white;
    	}
    
    HTML:
    <div class="control"> 
    < div id="results"> 
              <table id="featuretable">
                <tbody id="featuretbody">
                </tbody>
              </table>
       </div>
    </div>
    which totally threw out the layout until I took out that last </div>, at which point everything fell into place... is there something I'm missing here? thanks for any tips...

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,862
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Please post your complete code a link to your page. The error might be somewhere else.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #3
    Senior Coder xelawho's Avatar
    Join Date
    Nov 2010
    Posts
    2,981
    Thanks
    56
    Thanked 557 Times in 554 Posts
    sure. it's here

  • #4
    Regular Coder
    Join Date
    Jul 2002
    Location
    Kansas, USA
    Posts
    487
    Thanks
    0
    Thanked 54 Times in 53 Posts
    Count the opening and closing div tags in your body. There are 30 opening tags and 31 closing tags. These number should be equal. Code matching indicates the very last </div> is not needed. Did you remove part of a div somewhere and forget to remove its closing tag?

  • #5
    Senior Coder xelawho's Avatar
    Join Date
    Nov 2010
    Posts
    2,981
    Thanks
    56
    Thanked 557 Times in 554 Posts
    quite likely.

    but (from what I can tell) that end div isn't the problem... because (and here's where it gets weird) if I take it out, the minimap (click on a category on the right, click on a name, in the infowindow tab click on location), which is created by this code:

    Code:
                    var marker2 = new google.maps.Marker(point, { icon:gicons[category], clickable:false}); 
                    var tab1 = new google.maps.InfoWindowTab("Info", html);
                    var tab2 = new google.maps.InfoWindowTab("Location", '<div id="detailmap">');
                    var infoTabs = [tab1,tab2];
                    marker.openInfoWindowTabsHtml(infoTabs, {maxWidth: '250'});
                    var dMapDiv = document.getElementById("detailmap");
                     var detailMap = new GMap2(dMapDiv,{size:new GSize(250,150)});
                     detailMap.setCenter(point, 16);
                    detailMap.setMapType(G_MAPMAKER_NORMAL_MAP);
                     detailMap.addControl(new GSmallMapControl());
                    var CopyrightDiv = dMapDiv.firstChild.nextSibling;
                    var CopyrightImg = dMapDiv.firstChild.nextSibling.nextSibling;
                    CopyrightDiv.style.display = "none"; 
                    CopyrightImg.style.display = "none"
                    detailMap.addOverlay(marker2);
                    marker.show();
                      });
    disappears (but only in IE), and the only way to get it back is by adding that seemingly useless end tag...

  • #6
    Regular Coder
    Join Date
    Jul 2002
    Location
    Kansas, USA
    Posts
    487
    Thanks
    0
    Thanked 54 Times in 53 Posts
    I'm not familiar with the code, but why do you have an opening div tag in tab2 and where is its closing tag?
    Code:
    var tab2 = new google.maps.InfoWindowTab("Location", '<div id="detailmap">');
    I assume this code is to be inserted into the DOM. You should probably insert the closing tag also instead of leaving it in the raw HTML - then at least the validator would ignore it.

  • #7
    Senior Coder xelawho's Avatar
    Join Date
    Nov 2010
    Posts
    2,981
    Thanks
    56
    Thanked 557 Times in 554 Posts
    yeah, tried that. Doesn't do anything just doing that, and if I do that and remove that hanging closing tag I get the minimap problem described above...



    but I closed it up anyway, just to keep things nice...

  • #8
    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 xelawho,
    Maybe the validator will help you. See the links about validation in my signature line below.


    http://validator.w3.org/check?verbos...o.com%2Fmap%2F



    .
    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

  • #9
    Senior Coder xelawho's Avatar
    Join Date
    Nov 2010
    Posts
    2,981
    Thanks
    56
    Thanked 557 Times in 554 Posts
    Hello Excavator - unfortunately not. The only div references in the validator are to two closing divs - one that I added after kansel's suggestion and the other that I talk about above, that is needed to make the minimap work in IE.

    no big deal. if it works cross-browser, it works. I don't really need to understand why.

    One thing I've been wondering for a while, though - that "splelchecker" in your sig line... that's meant to be ironic, right?

  • #10
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,675
    Thanks
    22
    Thanked 1,827 Times in 1,811 Posts
    Quote Originally Posted by xelawho View Post
    Hello Excavator - unfortunately not. The only div references in the validator are to two closing divs - one that I added after kansel's suggestion and the other that I talk about above, that is needed to make the minimap work in IE.
    Invalid code is still invalid, whether it works or not.
    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

  • #11
    Senior Coder xelawho's Avatar
    Join Date
    Nov 2010
    Posts
    2,981
    Thanks
    56
    Thanked 557 Times in 554 Posts
    Quote Originally Posted by Excavator View Post
    Invalid code is still invalid, whether it works or not.
    absolutely. And I'd love to make it valid, but it stops working if I do...

  • #12
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,675
    Thanks
    22
    Thanked 1,827 Times in 1,811 Posts
    I think since it's .js, this line #340 should not have <div></div> in it. Something more like this maybe - var tab2 = new google.maps.InfoWindowTab("Location", 'detailmap');
    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

  • #13
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,675
    Thanks
    22
    Thanked 1,827 Times in 1,811 Posts
    Quote Originally Posted by xelawho View Post
    ...
    disappears (but only in IE), and the only way to get it back is by adding that seemingly useless end tag...
    If you clear the floats in #wrapper is the extra closing </div> needed? Try
    Code:
    #wrapper {
    margin: 10px;
    overflow: auto;
    }
    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:

    xelawho (02-22-2011)

  • #14
    Senior Coder xelawho's Avatar
    Join Date
    Nov 2010
    Posts
    2,981
    Thanks
    56
    Thanked 557 Times in 554 Posts


    thanks, Excavator. Clearing the float worked

    for the other one, the validator doesn't seem to mind if I leave it at '<div id="detailmap">' without closing the div so I am happy there.

    There's some stuff about aligning the text to the logo that I've googled and only vaguely understand, but the other one that has really got me is the table nested inside the div at line #790:

    Code:
    <div class="control"> <div id="results"> 
              <table id="featuretable">
                <tbody id="featuretbody">
                </tbody>
              </table>
    		 </div>
    		</div>
    validator says that I am closing the table before it has finished (and then notes that it may be nested badly) but neither of these are the case, afaik...

  • #15
    Senior Coder xelawho's Avatar
    Join Date
    Nov 2010
    Posts
    2,981
    Thanks
    56
    Thanked 557 Times in 554 Posts
    ok, got that one sussed, too... apparently the table needed child elements before the validator would give me the

    ... so I added a couple of empty ones like this:
    <tr><th></th></tr>

    which made absolutely no difference to the working of the page, but it appears that everyone's happy...


  •  
    Page 1 of 2 12 LastLast

    Posting Permissions

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