Bitcoin Forum
May 10, 2024, 01:18:48 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: <!DOCTYPE HTML> vs. <!DOCTYPE HTML PUBLIC> (WTF!)  (Read 815 times)
BitcoinMoxy (OP)
Member
**
Offline Offline

Activity: 119
Merit: 100


BitcoinMoxy.com


View Profile WWW
May 31, 2013, 10:49:06 PM
 #1

I just encountered a weird thing (not aliens).


I wasn't giving this much attention until the final stages of cleaning up the markup of my site, having decided to go fully HTML5 (which I believe was the right decision).

Quoting from the web as referenced to by Wikipedia:

Quote
Since web browsers are implemented with special-purpose HTML parsers, rather than general-purpose DTD-based parsers, they don't use DTDs and will never access them even if a URL is provided. The DOCTYPE is retained in HTML5 as a "mostly useless, but required" header only to trigger "standards mode" in common browsers.
(from http://www.whatwg.org/specs/web-apps/current-work/multipage/syntax.html#the-doctype)

Using <!DOCTYPE HTML> as recommended by the W3C produced a glitch in the rendering of my site which otherwise validates neatly. Coincidentally adding the PUBLIC identifier to the DOCTYPE declaration fixed the glitch.


Here's a pic using <!DOCTYPE HTML> (notice the gap at the bottom of the page, use the black square down left as a reference point):




And <!DOCTYPE HTML PUBLIC> (no gap, as it should be):




Any HTML/Web Standards experts around who can tell me what causes this? The source was otherwise left unmodified (could be Chrome related). Just curious.

See the source/page on BitcoinMoxy.com (the info page, or any other pages have not been cleaned up yet, so it just concerns index.html)


Have a good Friday evening


BitcoinMoxy.com - Your Gateway into the World of Bitcoin for Newcomers, Day Traders, Advertisers.
Service updates: https://bitcointalk.org/index.php?topic=254631.0
"Your bitcoin is secured in a way that is physically impossible for others to access, no matter for what reason, no matter how good the excuse, no matter a majority of miners, no matter what." -- Greg Maxwell
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715347128
Hero Member
*
Offline Offline

Posts: 1715347128

View Profile Personal Message (Offline)

Ignore
1715347128
Reply with quote  #2

1715347128
Report to moderator
1715347128
Hero Member
*
Offline Offline

Posts: 1715347128

View Profile Personal Message (Offline)

Ignore
1715347128
Reply with quote  #2

1715347128
Report to moderator
Foxpup
Legendary
*
Offline Offline

Activity: 4354
Merit: 3044


Vile Vixen and Miss Bitcointalk 2021-2023


View Profile
June 01, 2013, 01:50:23 AM
 #2

And <!DOCTYPE HTML PUBLIC> (no gap, as it should be):
This is not a valid DOCTYPE. PUBLIC must be followed by both a public and system identifier (eg, <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">). Without a valid DOCTYPE, your browser may take it upon itself to "correct" any irregularities in your markup (even if your markup is syntactically valid).

For example, in Firefox, your body's 0 px margin is not always inherited by other elements. Whereas, if you had used a valid DOCTYPE, your body's margin will be inherited, resulting in all elements which don't specify their own margin to have a 0 px margin instead of the default margin, which is what's screwing up your spacing (in reality, it's not screwed up at all: it's exactly what you asked for, even though it's not what you meant). At least, that's what's happening in Firefox. Other browsers may correct your markup in different ways, resulting in your page appearing different in different in different browsers.

TL;DR: If you use <!DOCTYPE HTML> (or any other valid DOCTYPE), your browser will display exactly what your markup specifies. If this differs from what you wanted or expected, there is a bug in your markup.
If you use <!DOCTYPE HTML PUBLIC> (or any other invalid DOCTYPE), your browser will attempt to fix such bugs, resulting in your page looking correct even if it is not. However, this is not valid and your page is likely to look different (and may even look worse than if the bug was not fixed at all) in different browsers.

Will pretend to do unspeakable things (while actually eating a taco) for bitcoins: 1K6d1EviQKX3SVKjPYmJGyWBb1avbmCFM4
I am not on the scammers' paradise known as Telegram! Do not believe anyone claiming to be me off-forum without a signed message from the above address! Accept no excuses and make no exceptions!
BitcoinMoxy (OP)
Member
**
Offline Offline

Activity: 119
Merit: 100


BitcoinMoxy.com


View Profile WWW
June 06, 2013, 12:55:22 AM
 #3

You were absolutely correct about the doctype declaration. It was Chrome indeed which displayed the page as I wanted but not according to specifications. Which is what caused the confusion.

Thank you very much.


Now I don't know if you've got another 5 minutes on your hand to help me figure out why Internet Explorer still displays a gap down there (though different from the doctype case from what it looks like)...

It seems to be caused by the first <span> element inside <div id="status">.

I'll send a small token of appreciation (like a buck twenty) to you or anybody else who can get IE to align with my markup vision Smiley (unless it requires non-standard workarounds, then don't bother).


Regards


BitcoinMoxy.com - Your Gateway into the World of Bitcoin for Newcomers, Day Traders, Advertisers.
Service updates: https://bitcointalk.org/index.php?topic=254631.0
Foxpup
Legendary
*
Offline Offline

Activity: 4354
Merit: 3044


Vile Vixen and Miss Bitcointalk 2021-2023


View Profile
June 06, 2013, 04:41:51 AM
 #4

Now I don't know if you've got another 5 minutes on your hand to help me figure out why Internet Explorer still displays a gap down there (though different from the doctype case from what it looks like)...

It seems to be caused by the first <span> element inside <div id="status">.

I'll send a small token of appreciation (like a buck twenty) to you or anybody else who can get IE to align with my markup vision Smiley (unless it requires non-standard workarounds, then don't bother).
You mean the gap between the image and the bottom of the page? IE always leaves a gap between the last block and the bottom of the page, even if the block has no bottom margin or padding. I don't know how to get rid of it, sorry. I have long since given up on trying to get IE to display pages correctly. This isn't the worst violation of the HTML standard I've seen from IE, not by a long shot.

Will pretend to do unspeakable things (while actually eating a taco) for bitcoins: 1K6d1EviQKX3SVKjPYmJGyWBb1avbmCFM4
I am not on the scammers' paradise known as Telegram! Do not believe anyone claiming to be me off-forum without a signed message from the above address! Accept no excuses and make no exceptions!
BitcoinMoxy (OP)
Member
**
Offline Offline

Activity: 119
Merit: 100


BitcoinMoxy.com


View Profile WWW
June 06, 2013, 04:50:48 PM
 #5

Now I don't know if you've got another 5 minutes on your hand to help me figure out why Internet Explorer still displays a gap down there (though different from the doctype case from what it looks like)...

It seems to be caused by the first <span> element inside <div id="status">.

I'll send a small token of appreciation (like a buck twenty) to you or anybody else who can get IE to align with my markup vision Smiley (unless it requires non-standard workarounds, then don't bother).
You mean the gap between the image and the bottom of the page? IE always leaves a gap between the last block and the bottom of the page, even if the block has no bottom margin or padding. I don't know how to get rid of it, sorry. I have long since given up on trying to get IE to display pages correctly. This isn't the worst violation of the HTML standard I've seen from IE, not by a long shot.

Foxpup, thanks alot for your input.
IE seems to not render a gap when the last div in the document is either left empty completely or if it just has text without another <span> in it. Making it a floating element works, too, but then it offsets the hidden popup <span> element differently in all browsers, causing more annoyance. Spent an hour and a half last night just fooling around with trial and error and couldn't get it fixed the way I wanted.

I'll either give it another half hour tonight or go in favour of Firefox/Chrome beauty.

Sent you a buck twenty.


BitcoinMoxy.com - Your Gateway into the World of Bitcoin for Newcomers, Day Traders, Advertisers.
Service updates: https://bitcointalk.org/index.php?topic=254631.0
Foxpup
Legendary
*
Offline Offline

Activity: 4354
Merit: 3044


Vile Vixen and Miss Bitcointalk 2021-2023


View Profile
June 07, 2013, 08:09:49 AM
 #6

IE seems to not render a gap when the last div in the document is either left empty completely or if it just has text without another <span> in it. Making it a floating element works, too, but then it offsets the hidden popup <span> element differently in all browsers, causing more annoyance. Spent an hour and a half last night just fooling around with trial and error and couldn't get it fixed the way I wanted.
Huh It makes absolutely no difference on my computer using IE 8.0. Removing the spans leaves exactly the same gap. The only thing that makes any difference at all is increasing the padding/margins, which increases the size of the gap (as expected), but nothing I've tried will reduce the gap or remove it completely. I wouldn't have thought floating it would make a difference, but I never thought to try that because it'll just screw up the pop-up even if it works. I don't think there's any way to float it and still have the pop-up work the way you want.

Sent you a buck twenty.
Thanks. Grin

Will pretend to do unspeakable things (while actually eating a taco) for bitcoins: 1K6d1EviQKX3SVKjPYmJGyWBb1avbmCFM4
I am not on the scammers' paradise known as Telegram! Do not believe anyone claiming to be me off-forum without a signed message from the above address! Accept no excuses and make no exceptions!
BitcoinMoxy (OP)
Member
**
Offline Offline

Activity: 119
Merit: 100


BitcoinMoxy.com


View Profile WWW
June 07, 2013, 04:42:31 PM
 #7

IE seems to not render a gap when the last div in the document is either left empty completely or if it just has text without another <span> in it. Making it a floating element works, too, but then it offsets the hidden popup <span> element differently in all browsers, causing more annoyance. Spent an hour and a half last night just fooling around with trial and error and couldn't get it fixed the way I wanted.
Huh It makes absolutely no difference on my computer using IE 8.0. Removing the spans leaves exactly the same gap. The only thing that makes any difference at all is increasing the padding/margins, which increases the size of the gap (as expected), but nothing I've tried will reduce the gap or remove it completely. I wouldn't have thought floating it would make a difference, but I never thought to try that because it'll just screw up the pop-up even if it works. I don't think there's any way to float it and still have the pop-up work the way you want.

Sent you a buck twenty.
Thanks. Grin

Updated the page. Enjoy your burrito Wink


BitcoinMoxy.com - Your Gateway into the World of Bitcoin for Newcomers, Day Traders, Advertisers.
Service updates: https://bitcointalk.org/index.php?topic=254631.0
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!