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:

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...