Which way is better:
1)
div#main {
width: 100%;
text-align: left;
}
2)
div#main{ //no whitespace before { sign
width: 100%;
text-align: left;
}
3)
div#main
{
width: 100%;
text-align: left;
}
4)
div#main {width: 100%; text-align: left;}
5)
div#main {
width: 100%; //no tab or whitespaces before width: 100%;
text-align: left; //no tab or whitespaces before text-align: left;
}
?
The same question is about .js files. The reason I ask is the less spaces (1 byte), tabs(1 byte) and new lines (2 bytes), the less time it takes to upload it to the user’s computer. As result, the web-site loads faster. Of course, 200 bytes is not so significant, but who cares what’s in javascript file? I mean user prefers speed, not the correct design of javascript files he doesn’t see…
As a professional, what would you recommend to a newbie about css and js files? php files are more clear, write php files the way any programmer is able to read them and modify if needed – with comments etc.
You should use a CSS Compressor and a JS Compressor and combine your files.
When writing, do whatever is easiest for you, but keep it consistent with Coding Standards.