CSS efficiency

Scoochi2

New Member
Messages
185
Reaction score
0
Points
0
so let's say i need to repeat the section 15x:
<span class="classname">Link</span> [~400bytes]
instead of just tiling a (15x1) [~100bytes] with CSS [~200bytes]
about 600bytes

but in your case:
<span class="classname">Link<div class="div_classname"></div></span> [~1200bytes]
and the css would be: [~250bytes]
about 1450bytes
CSS:
Code:
div.block{
height:15px}
Total size of CSS: 26 bytes
And just migrate your styling from the span to the div, as it is unnecessary.

HTML:
Code:
<div class='block'><a href='http://www.website/thepage.php'>link</a></div>
Total size of HTML: 72 bytes

There ^ :)
A total of 98 bytes (for an uber-slow 1 kbps connection speed, it will take approximately 0.784 seconds to download) using that method. How big was the image alone again?
BTW, this only takes into account the code needed for the effect. Anything else you have in is irrelevant to what you want in this topic.

Or maybe I'm reading between the lines. But like I said, even if the filesize is slightly larger, the browser doesn't have to fetch and then render an image nor work out for itself how to display it. This is why style sheets were designed...
 
Last edited:

diabolo

Community Advocate
Community Support
Messages
1,682
Reaction score
32
Points
48
well, if you set the <div> to height:15, and all that is a solid color..
where the h*ll are you going to see the text?
 

Scoochi2

New Member
Messages
185
Reaction score
0
Points
0
yeah, I forgot you were tiling it :)
lol, change it to 225px, same as 15 15px high images.
 
Top