Is there any performance difference between:
p {
margin:0px;
padding:0px;
}
and omitting the final semicolon:
p {
margin:0px;
padding:0px
}
Thanks in advance!
Is there any performance difference between:
p {
margin:0px;
padding:0px;
}
and omitting the final semicolon:
p {
margin:0px;
padding:0px
}
Thanks in advance!
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.
You're actually better off using a CSS minifier. In short, it will remove all of the unnecessary spaces and bloat (e.g., changing #ffffff to #fff where appropriate, removing comments, etc). Some of them will automatically remove the last semicolon in each block. Be aware this can cause issues, as @t-j-crowder mentioned, if you later add lines to the end of the block and forget to add back the semicolon!
Also, make sure you're using external CSS files where possible and store them on the same server/ FQDN. If you can, combine your external CSS files into one so you minimize the number of requests the browser has to make.
This will speed up the download time and give you the biggest bang for your buck in terms of optimization. If the browser caches the files, subsequent visits to the same page (or to different pages using the same stylesheets) will be faster.