Jump to content

Recommended Posts

Posted

I made my webpage, then at the end added the <!doc> tag at the top.

It messed up my webpage, so I changed it from XHTML 1.0 to HTML 4.1

It still messed some stuff, but fixed others.

 

Can I just forget about the <!doc> tag altogether?

I have seen many sites that just start with <html>

 

thanks!

 

Posted

The doctype tells the browser how to render the page. For it to really work you need to have a valid markup.

 

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

 

<!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" xml:lang="en" lang="en"> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

 

 

Posted
I made my webpage, then at the end added the <!doc> tag at the top.

It messed up my webpage, so I changed it from XHTML 1.0 to HTML 4.1

It still messed some stuff, but fixed others.

 

Can I just forget about the <!doc> tag altogether?

I have seen many sites that just start with <html>

 

thanks!

You do not need it. However, if you added the DOCTYPE and things started displaying incorrectly, it's very likely that your code is malformed. In other words, you coded something wrong, and with the strict standards of the DOCTYPE, it stands out.

You should validate your webpage here to see what is wrong:

http://validator.w3.org/

 

More info about DOCTYPE:

http://www.w3schools.com/tags/tag_DOCTYPE.asp

Posted

Thanks!

The code isn't to badly wrong, it just had to add a <br /> and it was good.

I will keep that link for when I post the website :lol:

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...