CSS Compression

This is a discussion on "CSS Compression" within the Web Page Design section. This forum, and the thread "CSS Compression are both part of the Design Your Website category.



Go Back   Webforumz.com > Main Forums > Design Your Website > Web Page Design

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old May 1st, 2007, 16:13
Junior Member
Join Date: Apr 2007
Location: Notts, England
Posts: 49
Thanks: 0
Thanked 0 Times in 0 Posts
CSS Compression

Hi All,

I have just spent the last few hours trying to figure out how to optimise my css server side every time the page is called, and i think ive finally got it working.

however does anyone know the benefits and speed of doing it manually (removing whitespace, tabs and carriage returns) or having a script do it for you server side?
Reply With Quote

  #2 (permalink)  
Old May 1st, 2007, 16:28
craig's Avatar
Reputable Member
Join Date: Sep 2005
Location: Preston, UK
Age: 21
Posts: 381
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to craig
Re: CSS Compression

Generally i don't see the point in trying to compress around 7kb of data to 4kb of data. It really seems negligable to me.
Reply With Quote
  #3 (permalink)  
Old May 1st, 2007, 16:34
Junior Member
Join Date: Apr 2007
Location: Notts, England
Posts: 49
Thanks: 0
Thanked 0 Times in 0 Posts
Re: CSS Compression

it has the benefit of not being easy to read, and also when dealing with mobile content is best to break it down as much as possible.

so instead of seeing:

Code: Select all
body {
margin:0;
padding: 0;
height: 0;
width: 0;
z-index; 0px;
border: 300px solid black;
background-image: url('mypicture.png');
}

div {
margin:0;
padding: 0;
height: 0;
width: 0;
z-index; 0px;
border: 300px solid black;
background-image: url('mypicture.png');
}
you get:
Code: Select all
body {margin:0;padding: 0;height: 0;width: 0;z-index; 0px;border: 300px solid  black;background-image: url('mypicture.png');}div {margin:0;padding: 0;height:  0;width: 0;z-index; 0px;border: 300px solid black;background-image:  url('mypicture.png');}
what ive done is that i see it as the first example when editing but when people view it in a browser they see it like the 2nd example.
Reply With Quote
  #4 (permalink)  
Old May 1st, 2007, 16:42
craig's Avatar
Reputable Member
Join Date: Sep 2005
Location: Preston, UK
Age: 21
Posts: 381
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to craig
Re: CSS Compression

Why is not being easy to read a benefit?

Code should be human readable. If you're worried about copyright, there isn't much you can do about it, if someone really wants to use your code they will, whether it's in one long line or not.

And why is it best for mobile content like that?

If you are going to be designing for mobiles too then create a different CSS stylesheet tailored to that platform.
Reply With Quote
  #5 (permalink)  
Old May 1st, 2007, 16:49
Junior Member
Join Date: Apr 2007
Location: Notts, England
Posts: 49
Thanks: 0
Thanked 0 Times in 0 Posts
Re: CSS Compression

its something that ive seen google do, and when it comes to mobile content even a few kb can save time and money.

http://www.google.com/ig/mobile
Reply With Quote
  #6 (permalink)  
Old May 1st, 2007, 16:57
craig's Avatar
Reputable Member
Join Date: Sep 2005
Location: Preston, UK
Age: 21
Posts: 381
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to craig
Re: CSS Compression

From what I can see, thats just inline CSS, there's no style sheet being called :s
Reply With Quote
  #7 (permalink)  
Old May 1st, 2007, 17:14
Ryan Fait's Avatar
SuperMember

SuperMember
Join Date: May 2006
Location: Las Vegas
Posts: 3,786
Thanks: 0
Thanked 0 Times in 0 Posts
Re: CSS Compression

Quote:
Originally Posted by motlive View Post
its something that ive seen google do, and when it comes to mobile content even a few kb can save time and money.

http://www.google.com/ig/mobile
Google probably does it because they have 10000000000 TB of bandwidth per day. There is no need for you to compress your CSS.
Reply With Quote
  #8 (permalink)  
Old May 2nd, 2007, 00:27
Reputable Member
Join Date: Jul 2006
Location: Scotland
Age: 22
Posts: 357
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to snow
Re: CSS Compression

Quote:
optimise my css server side every time the page is called
That sounds like it's putting you'd be putting more of a strain on your server rather than any benefit to the client.
Reply With Quote
  #9 (permalink)  
Old May 2nd, 2007, 06:21
Junior Member
Join Date: Apr 2007
Location: Notts, England
Posts: 49
Thanks: 0
Thanked 0 Times in 0 Posts
Re: CSS Compression

yep thats the conclusion i came to. nice waste of an afternoon

Reply With Quote
  #10 (permalink)  
Old May 2nd, 2007, 11:06
Ryan Fait's Avatar
SuperMember

SuperMember
Join Date: May 2006
Location: Las Vegas
Posts: 3,786
Thanks: 0
Thanked 0 Times in 0 Posts
Re: CSS Compression

Haha, it would take a HUGE style sheet to make a server blink.
Reply With Quote
  #11 (permalink)  
Old May 2nd, 2007, 11:13
Junior Member
Join Date: Apr 2007
Location: Notts, England
Posts: 49
Thanks: 0
Thanked 0 Times in 0 Posts
Re: CSS Compression

yep and mine is about 200 lines or so.

i have seen a css sheet which was over 2000 lines long :S that was a little scary.
Reply With Quote
Reply

Tags
php compression

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 13:25.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43