Auto created teext when opening new html-page in Expression web - html

I'm learning to use Expression Web 4.0
When opening a new html-page, the following text is automatically created:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
Is this code redundant, is this needed (or demanded by owners), or what?
Bent

The doctype is used to tell the web browser the particular version of html used to create the web page. It's also responsible for triggering a particular browser rendering mode. It is standardized by World Wide Web Consortium (W3C)
check the list of DTD

Related

HTML: How to initiate HTML document header

I am still pretty new to HTML and programming in general so this is more of a curiosity question but I am asking as I want to use it the right way.
Whenever I have to initiate an HTML document I start it as below and never observed any issues.
However, when I work in Adobe Dreamweaver and create a new document there it always shows me the below initiation.
Of course I can overwrite this but I would like to know what is the difference and when it would make sense to use any of Adobe's suggested attributes or to add something else to my first four lines.
Can someone help me with this ?
My current initiation:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<!-- ... -->
HTML initiation shown in Dreamweaver:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- ... -->
Many thanks in advance,
Mike
<!DOCTYPE html>
This is HTML 5. The current standard.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
This is XHTML 1.0 Transitional. A standard from 2000 designed to combine the transition from HTML 3.2 (1997) to HTML 4 (1998) and XML (which never saw wide use, except while pretending to be HTML 4.
can you explain the single attributes that are different to mine and when it would make sense to use any of them ? Esp. regarding
"PUBLIC",
That isn't an attribute. The PUBLIC portion of a Doctype declaration tells the client where it can download the DTD. (As opposed to the SYSTEM portion which gives it an identifier that it can use to look it up from a local catalogue).
Browsers have never cared about DTDs.
"xmlns",
XML Namespace. It lets you distinguish between elements and attributes that have the same name but are from different specifications.
"http-equiv"
"This is equivalent to an HTTP header with this name"
It is largely a joke. Nothing really implements this except for the character encoding portion of the content-type header and HTML 5 gives much nicer syntax for specifying that.
"content".
The value of the above.
Your first declaration is a HTML5 declaration which is the current standard.
The declaration produces by Dreamweaver is a deprecated XHTML 1.0 Transitional declaration (maybe your Dreamweaver is not up-to-date ?).
See here for more information on doctype

I need help in understating that, if I change the <!DOCTYPE> in the html page, will it affect some other functionality

Current DOCTYPE:
"!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
Required DOCTYPE:
"!DOCTYPE HTML"
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd >
is to tell the browser that the document is XHTML 1.0
<!DOCTYPE HTML>
is to tell the browser that this document uses HTML5, the latest version of HTML available, also a 'living standard' from w3c
It is perfectly fine to change it, as HTML5 continue to support the older function.
(Just like 'opening a word 2003 file .doc' with Microsoft Word 2007)

IE9: how to forces 2 pages to display the same why? The first is in Quirks mode, the other IE7 Compatible

No matter what I try to do, pages keep looking significantly different depending on whether they are from my local machine or the development server. When pressing F12, I've finaly noticed that pages have different instructions on the top:
1) Pages displayed by my local machine have the following values:
Browser Mode: IE9 Compatible View
Document Mode: Quirks
HTML starts with this line of code
<html xmlns="http://www.w3.org/1999/xhtml">
2) Whereas pages displayed by the development server have the following values:
Browser Mode: IE9 Compatible View
Document Mode: IE7 Standards
HTML starts with this line of code
<!-- DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" -->
<html xmlns="http://www.w3.org/1999/xhtml">
It looks like the the first line of the instruction that's making those pages to display differently.
Do I need to add that line to pages coming from my local machines as well? Why and how to do that?
Thanks for helping
Without a doctype, you are in quirks mode, and, no matter what else you do, pages won't look the same as in strict mode.
New web pages should always have a doctype and always use strict. Rarely would a newly created page have a need for quirks or the transitional doctype you are using.
Add either that transitional doctype on your first line or, preferably, the strict version:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
Better yet, use the new type: <!DOCTYPE html> which will keep all browsers in strict mode, including IE back to IE6 (or even IE4? Don't recall).

The HTML Doctype is automatically changing from XHTML 1.2 to XHTML 1.0

On a html page the doctype I've used is as follows (for a mobile website):
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.2//EN"
"http://www.openmobilealliance.org/tech/DTD/xhtml-mobile12.dtd">
which after uploading on the web server automatically turns into
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
To make it clear this change happens as soon as I save the page on the server. (using cPanel)
Any idea on what could be the reason for this (automatic) change?
Because of this the layout of the page is not coming out as I expect it to be on some browsers.
Ok, I think I've figured out the exact problem, it happens only when I use the cPanel editor to edit the html page and not when I just upload the file and not open it in their editor. As Jeremy said in the comments below the question, it's cPanel changing (screwing?) it for me!
Thanks a lot everyone, especially Jeremy! :)
btw should I now delete this question or keep it as someone else might also face similar issue?

Content overlapping when change doctype from HTML to XHTML

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.