Which doctype should I use, if I want to use costumizable divs. With divs animation, images moving, setting div opacity, etc.
I've tried to create a div through javascript, setting its background-color, position, width and height, and adding an onmouseover event to it.
Everything works ok untill I wanted to put a doctype at my html.
I've tried the transitional and strict, both made my div disappear.
So I've inserted the HTML5 type of doctype and my div appeared ok.
Well, I want to make my website with html4.
Is it possible?
Everything I've read lately seems to say that you should just use a plain doctype so the browsers can use the latest rendering standards.
<!DOCTYPE HTML >
There are three Doctype versions for Html 4.01
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
"http://www.w3.org/TR/html4/frameset.dtd">
But the best solution is to use HTML 5's one
<!DOCTYPE html >
Adding HTML5 doctype will cause the browser to read it as a html5 document. You will have to keep it in mind. There is not that much difference in them. HTML5 is just a version with better readability. You will have to consider this when you write your code.
Related
Does anyone know a solution to my problem or where I should look for this to work?
I am working on a website ( http://www.awww.nl ) and I got all the positioning of the elements the way I wanted... but when I checked in IE most of the positioning is totally off!
Especially on the post pages (for example: http://awww.nl/superlieve-luiaard/ ) the design is moving all the way to the right in IE (in chrome on my Imac everything is correct) And on the homepage the button to add pictures disapears.
I tried to fix it by using different Doctypes but that didn't work.
Your website is rendering in Quirks mode, probably because of a doctype mistake.
I do not recognize your current doctype:
<!DOCTYPE XHTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
Can you try changing your doctype to this:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
If that doesn't fix it, then add to the <head> tag:
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
This should render it in the highest version available. However, I would recommend that you look for the doctype mistake and fix it as it is the root of the cause.
I want to change my doctype to XHTML but it breaks all the content in my page,
how to resolve the issue..?
I'll show you what was the change I've done on my document.
from this doc
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
to
<!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
It causes overlapping the content throughout the site, I'm shocked :( CSS styles are working, I mean in color and font sizes, but paragraphs widen to the right side.
Can anyone tell a solution..? I'm changing the doctype because something like a floating Ad is works only in XHTML format in IE it doesn't support the HTML format that is why.
Thanks in advance!
Paul
See: http://hsivonen.iki.fi/doctype/
This doctype:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
puts your page into Quirks Mode.
Unfortunately for you, your site has been made to work with Quirks Mode enabled - this was a fatal mistake.
The only sensible thing to do is to change the doctype to one that triggers (Almost) Standards Mode (such as the XHTML doctype in your question, or simply <!DOCTYPE html>).
Then, you'll unfortunately have to go through the laborious task of fixing your site.
Doing this should help your site to render more consistently between different web browsers, and that's a worthy secondary incentive.
Unfortunately, you'll have to redesign your site completely (CSS- and design-wise). Then, sticking a standards/almost standards mode doctype (such as <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">) on your web page should work.
I cam accross this specific situation today. On a client's website, the pages had multiple tags, some even with conflicting Doctypes:
Ex:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html><head>....</head></body>...</body>
</html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><head>....</head></body>...</body>
</html>
All this within the same page.
Will this cause any issues, if so which ones ?
The problem that this will cause is that it is invalid HTML and it is indeterminate how the content will be rendered.
This is pretty much the standard "web" answer, but basically it depends on how the browser handles it. It's obviously not standards-compliant HTML so it would be good to avoid it.
apart from that it is plain ugly and non-standard,
it has surely caused browser hickups in browser before, i dont know how the common browsers behave today.
i recall the day when one experimented with multiple body tags with different bgcolors to create a blinking background effect :)
I'm writing a web page. How do I know what doc type to use?:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
or
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
I believe the rationale behind using Transitional is that if your page uses deprecated html elements, the browsers will try to support them?
Thanks
I'd use <!DOCTYPE html>, it's by far the easiest alternative, and it triggers standards mode in all modern browsers as Anne van Kesteren noted several years ago.
You should prefer strict above transitional/loose/invalid(!). Your first transitional example is invalid. It will let any browser render in non-standards/quirks mode, it won't let IE render in almost-standards mode.
This site contains excellent background information and a compatibilty table. Here's an extract of relevance:
Standards mode, more stable validation target
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
This doctype also triggers the standards mode, and the decade-old HTML 4.01 validity definition is stable. Please be sure to test your image alignment in Firefox, Safari, Chrome or Opera 9 or 10. Testing image alignment with Internet Explorer is inadequate however be sure to test in IE8, too.
You’d like to use the Standards mode, but you still want to validate deprecated markup or you use sliced images in table layouts and don’t want to fix them
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
This gives you the Almost Standards mode (and the full Standards mode in really old Mozilla releases). Please note that your layouts based on sliced images in tables are likely to break if you later move to HTML5 (and, hence, the full Standards mode).
I'd say, go for HTML5 doctype <!DOCTYPE html>, unless you want a more stable validation target.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
HTML 4 Strict DTD if you
a) Don't plan on using HTML 5 elements
b) Don't plan on really using xhtml with Content-Type of application/xhtml+xml
In this day and age you really shouldn't be "transitioning" or trying to using old, deprecated non-standard elements. Go standard all the way.
If you do plan on trying out HTML 5, by all means just use <!DOCTYPE HTML> which is the HTML 5 DTD.
Do we use doctype only to render webpages in standard mode with IE6 ? or does doctype do something more than that?
The doctype actually tells ALL browsers the type of content in the page. In many browsers, you'll notice very little difference, but in IE it has two different rendering modes, so you'll see a larger difference.
You should be using a doctype on all of your HTML documents. The idea is that it will be a much simpler doctype in the future - HTML 5 looks like this:
<!DOCTYPE html>
Whereas HTML 4 is like this:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
And has Transitional or Strict options.
It's not just IE6, it tells all browsers how to attempt to render the page.
Good information here and here.
Doctype could also used to check that your page respects the W3C standard.