views:

75

answers:

4

Considerring two DIVs A and B, which A includes B, and CSS:

A { margin-left: -2000px; }
B { margin-left: 2000px; }

with this CSS, position of B is no difference to its situation with no CSS, i want to know will there be a performance decrease when rendering? Compare to the case of no CSS.

+1  A: 

Not really. If there was, you would be talking 0.01 of a seconds' worth.

If you applied conflicting settings to the same element, the last setting will be used.

Tim
+1  A: 

Considering the speed of most connections, you've probably not got much to worry about. Unless you're using a Stylesheet that has thousands of lines, might be good to put it through a Compression tool, but other than that, I wouldn't worry too much about it.

Kyle Sevenoaks
It seems to me he's asking about rendering performance, that is, if this would slow the browser down *after* the file has been downloaded and is ready for parsing.
Andy E
+1  A: 

The only situation when I noticed a performance decrease is with elements that have position:fixed (they stick to the same position while you scroll)... Firefox becomes (ever so slightly) choppy when you scroll the page.

Dan
+1  A: 

You are making the browser do uneccesary CSS calculation, so it will be a really tiny infinitesimal bit less performant. :)

No user will probably ever notice it!

To do a similarity with coding a processor take less when declaring a variable in this way:

var a = 0;

rather than doing:

var a = 1 - 1;

but I believe nobody (from a user stand point) will ever feel the difference except coders that would think at you as a wired personality when they read in your code such kind of stuff.

Marco Demajo