2

So the thing is, I am currently analyzing html documents by reading them though java and I see that the p tag is one of the most commonly used tags. I know that it's there to provide a new line, but what I don't know is why in some documents I see

<P>Hello world!</P>

and in others

<p>Hello world!</p>

Sometimes both are even used in the same document.

It seems to have exactly the same effect but I am just wondering if there is any reason these two variations exist.

Jonas Bartkowski
  • 357
  • 1
  • 6
  • 15

5 Answers5

9

There is no difference.

In HTML, elements are case-insensitive.

However, in XHTML, you must use lowercase.

Oriol
  • 274,082
  • 63
  • 437
  • 513
5

http://www.w3.org/TR/html-markup/documents.html#case-insensitivity

HTML is case-insensitive. as you can see in the documentation.

aahhaa
  • 2,240
  • 3
  • 19
  • 30
1

They're same. It does not matter if its lowercase or uppercase or even mixed.

JBN
  • 21
  • 6
  • Thanks! I was confused because some of the pages I read seemed to be automatically generated, which lead me to think there could be a difference. – Jonas Bartkowski Aug 15 '14 at 14:35
  • Usually, HTML is very lenient. Pages can be generated even without tags which is not a good way though ;) But that would be wrong in case you have to be verified by W3C (World Wide Web Consortium) – JBN Aug 15 '14 at 14:41
  • I think you can even do. , but what's the point. :D – aahhaa Aug 15 '14 at 17:08
1

<p></p> Is used for a new paragraph

HTML is case-insensitive, which means you can use both spellings.

samvdst
  • 618
  • 7
  • 22
1

there is no difference. Inherited from SGML, HTML is not case sensitive for elements and attributes.

I prefere to use the lower-case form... Else I've the impression that the coder is shouting at me ^^