tags:

views:

102

answers:

4

Is there any performance difference between:

p {
  margin:0px;
  padding:0px;
}

and omitting the final semicolon:

p {
  margin:0px;
  padding:0px
}

Thanks in advance!

+4  A: 

No there is not, the browser doesn't care about the trailing semicolon, even in IE6. The parser checks for it as a delimiter that's it.

If anything, since the browser is basically performing tokenization not much more complex than .split(';'), the second may be faster in a probably not measurable way simply because of the lack of an extra null token. But...the difference would be infinitesimal, and you do not need to worry about it either way.

Nick Craver
And more to the point, leaving out the final semicolon is a maintenance issue to be avoided.
T.J. Crowder
thanks mate! :D
n00b
+1  A: 

I highly doubt it. But, of course, no one has ever measured such a thing independently!

dicroce
A: 

No, ";" is seperator.

I think we can't talk about performance in CSS.

sundowatch
A: 

I think the main difference will be in the increased css file size. but even if your css file was too big it'll just increase by few bytes. so in short I think it is ok not to care about it.

John Saman