SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Addict
    Join Date
    Sep 2008
    Location
    Rudgwick, UK
    Posts
    378
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Driving me nuts - not sure how to explain the issue :/.

    Hi,

    Got a *REALLY* weird one here :/

    We are using multiple tabs, to show different content when they click a "next" button.

    Now, this all works fine - up until we found an issue with the background not working.

    After doing some testing in Frontpage, I was checking to see where it *thought* the div's were closing.

    I check the <div id="cat" one, and that seemed to think it was closing a few lines before it, at <br> ... god knows why!

    Please see screenshot for an example of what I mean.

    The odd thing is, if I copy all the content from the <div id="cat"> ... </div> into a seperate page, and check to see what the end <div is being recognised as - it works PERFECTLY!

    What on earth could cause this?

    We are using quite a bit of JS and advanced codes in the page, but surely that couldn't be causing it?

    TIA

    Andy
    Attached Images Attached Images

  2. #2
    SitePoint Addict
    Join Date
    Sep 2008
    Location
    Rudgwick, UK
    Posts
    378
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    All sorted (finally!)

    For anyone else who may have the same issue, it was a problem with having a rogue </center> tag, and that for some reason was making the browsers think the content had finished

    Removing that, and works like its meant to now =)

    Cheers

    Andy

  3. #3
    Team SitePoint AlexW's Avatar
    Join Date
    Apr 2000
    Location
    Melbourne
    Posts
    832
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Hi Andy,

    Glad to see you worked it out. It's always a little more satisfying when you nut it out yourself

    The <center> tag has been deprecated for a few years anyway, so it's not a bad idea to cut it if you can. It will still work in all browsers I know of, but 'centering' is a layout/display concept -- some users hear your page rather than see it -- so probably belongs in your CSS (as 'text-align:center').

    Also might be worthwhile setting up a test space somewhere where you can demonstrate any future issues you have -- if a pic is worth a thousand words, a demo is a million times easier to debug

    Cheers,

    Alex
    Alex Walker
    SitePoint Developer
    SitePoint - Learnable

  4. #4
    SitePoint Addict
    Join Date
    Sep 2008
    Location
    Rudgwick, UK
    Posts
    378
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    Thanks for the reply. The actual design was done by someone else (the person who runs the site) - and I'm just doing some perl/mysql coding for him - but that requires me working with his templates.

    Unfortunatly, he's mixed CSS and Tables, and lots of old-school coding (i.e <HTML> instead of <html>)

    I keep asking him to clean it up, as it makes my jobs a sod - but he doesn't seem too interested to LOL

    Cheers

    Andy

  5. #5
    Team SitePoint AlexW's Avatar
    Join Date
    Apr 2000
    Location
    Melbourne
    Posts
    832
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Ah, not a worry, Andy.
    Alex Walker
    SitePoint Developer
    SitePoint - Learnable

  6. #6
    SitePoint Wizard Stomme poes's Avatar
    Join Date
    Aug 2007
    Location
    Netherlands
    Posts
    10,287
    Mentioned
    51 Post(s)
    Tagged
    2 Thread(s)
    Hm, It does make sense that a <center> tag ends another block. In HTML you're also allowed to leave off the closing </p> and </li> and </td> (I think) tags, and the browser looks at the next open one, or the next block element opening, and silently closes the other. It could be there was a tag mixup and instead of letting tags nest, the browser needed to close the div before closing another block like <center>.

  7. #7
    Team SitePoint AlexW's Avatar
    Join Date
    Apr 2000
    Location
    Melbourne
    Posts
    832
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Stomme poes View Post
    In HTML you're also allowed to leave off the closing </p> and </li> and </td> (I think) tags, and the browser looks at the next open one, or the next block element opening, and silently closes the other.
    Personally I'm not sure it's worthwhile ever leaving off closing tags unless your name is Google or eBay and you're serving a gazjillion pageviews an hour.

    To my mind, it's equivalent to writing without paragraphs and punctuation. It might be possible for someone to read and understand your work but they'll need to try so much harder to get your meaning. If the browser is inferring where your tag closes, then you'll have to guess where the browser is inferring the tag is closing to bug fix it. You close the tag, and there's no doubt.

    There are lots of online HTML compressors out there. If you wanted to publish pages without closing tags, perhaps the best approach might be to develop the page with all tags properly 'bookended', THEN strip the optional tags with a post-processor before launch.

    Still not sure that is worth the effort in most situations.
    Alex Walker
    SitePoint Developer
    SitePoint - Learnable


Bookmarks

Posting Permissions

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