PDA

View Full Version : what is the minimum amount of html tags?


dreamweaver beginner
10-08-2009, 04:09 AM
Hello,

I believe I have falsely read that you need head and body tags in an html page.

I just wrote this code and it worked:

<html>
<p>testing to see if this works</P>
</html>

and it loaded fine into IE.

I then went to even further absurdity with this:

<html>
</html>

and that also loaded fine.

To me, that means the ONLY tag you need is <html></html>. you will get a blank page when you do this. but it technically is a web page.

any thoughts on this?

edbr
10-08-2009, 04:30 AM
use web standards , what do you think you are gaining from not using body and head sections?

dreamweaver beginner
10-08-2009, 05:07 AM
Hello,

thanks for responding. What I am trying to gain is atomic understanding. I want to know the very minimal code required. Then build from there. If I simply parrot code from a book and always include a bunch of tags "just because" then I am operating from superstition and lack of understanding.

It's kind of like somebody learning equations like this:

f(x) = 3x + 5

It's useful to know you don't need the constant:

f(x) = 3x

it's also useful to know you don't need the variable on the right hand side:

f(x)= 5

I plan to use best practices for coding. But building from the ground up and understanding every part. To me there is a very important difference between: "do this because you must" and "do this because you should".

so am I correct in stating that the minimal amount of code to create a web page is <html></html> ?

Corrosive
10-08-2009, 06:03 AM
so am I correct in stating that the minimal amount of code to create a web page is <html></html> ?

No, you are incorrect and here's why...

Every language on the planet has semantics. Rules that bind words together so that they make sense. HTML *Hypertext Markup Language* is no different. If you just use the html tags you are like a 2 year old saying 'ball blue'. Yes, we are intelligent enough as humans to work out what the toddler is saying and they have communicated that the ball is blue successfully but it is NOT correct and NOT a sentence.

The toddler then learns to construct a sentence correctly by saying 'The ball is blue.' They learn to use English semantics to construct a much more understandable sentence.

You need to have head and body tags to truly have created a web page in the same way that you need a capital letter and a full stop to truly say you have created a sentence. Otherwise you are just saying words.

Head tags hold a lot of search engine and browser related information that is important for the correct understanding of the web page. If you have head tags then you need body tags to differentiate the two.

It is page structure, W3 standards and what everyone else does! Sometimes you don't need to go into every single detail to make something work. I admire that you are interested, inquisitive and want to understand but some things just are. I bet you don't question why you construct sentences in the way you do every day. You just accept that is language and get on with it ;)

Hope this helps.

domedia
10-08-2009, 06:39 AM
There is a protocol for his language hosted at w3c.org if you want to get into the technical part of it, which I recommend 8) Much easier than just guessing.

Remember just because it shows up with something in a browser, does not mean it's a valid document for the web.