9, January 2009

Shorthand - webmaster forum

 
Webdigity webmaster forums
This forum shares its ad revenue with its members!
[ Home | Help | Search | Forum's Shop | Archive | Login | Register | Webmaster Directory ]
Webdigity Webmaster Forums  >  Design and Layout  >  Web Page Design  >  CSS (Moderator: Meth0d)
Topic: Shorthand
« previous next »
Pages: [1] Print

Author Topic: Shorthand  (Read 1130 times)
OMG!I am geek
**
Gender: Male
Posts: 58
127 credits
Members referred : 0



« on: Mar 02, 2006, 02:54:47 PM »

Does anybody use CSS shorthand?
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 8357
43129 credits
Members referred : 3



« Reply #1 on: Mar 02, 2006, 02:57:45 PM »

Hmm I don't really know what this is.

Can you post a resource about it?

Trial and Error my two best teachers Cool
Join us @ facebook Visit through proxy or twitter Visit through proxy

Last blog : Monetizing Old Posts
OMG!I am geek
**
Gender: Male
Posts: 58
127 credits
Members referred : 0



« Reply #2 on: Mar 02, 2006, 04:08:23 PM »

I can do better.

Here is an example.

This is what I call LONG HAND css:

TABLE {
margin-top: 10px;
margin-right: 5px;
margin-bottom: 10px;
margin-left: 5px;
}

And this is what I call LEVEL 1 short hand:| TABLE { margin: 10px 5px 10px 5px;}

LEVEL 2:| TABLE { margin: 10px 5px; } /* Top & Bottom are 10 pixels, L & R are 5 px */

LEVEL 3:| TABLE { margin: 10px 0;}   /* if left and right are at Zero pixels */
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 8357
43129 credits
Members referred : 3



« Reply #3 on: Mar 02, 2006, 04:21:54 PM »

Oh now I got it.

I use it some times, but the long hand way is allways easier to edit.

Trial and Error my two best teachers Cool
Join us @ facebook Visit through proxy or twitter Visit through proxy

Last blog : Monetizing Old Posts
OMG!I am geek
**
Gender: Male
Posts: 58
127 credits
Members referred : 0



« Reply #4 on: Mar 02, 2006, 04:53:21 PM »

Sometimes you have to stop and think about your poor readers using DUN. (dial up)

Level 3 up there saves 8 bytes.  Imagine if you had a style sheet that had 1,000 objects (selectors, ids, classes) each with 5 declarations.  If each declaration would save the surfer 8 bytes, that would equal 40,000 bytes (39 KB). 

@ 56K modem speed (oxy-moron) would take 5.7 seconds off the download time.

I think it's worth it.
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 8357
43129 credits
Members referred : 3



« Reply #5 on: Mar 02, 2006, 04:57:31 PM »

You can do a small php script that will reduce the size of the file for the server, so you wiil be able to have both the advantages of those methods Smiley

Trial and Error my two best teachers Cool
Join us @ facebook Visit through proxy or twitter Visit through proxy

Last blog : Monetizing Old Posts
OMG!I am geek
**
Gender: Male
Posts: 58
127 credits
Members referred : 0



« Reply #6 on: Mar 02, 2006, 07:36:52 PM »

I don't know php.
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 8357
43129 credits
Members referred : 3



« Reply #7 on: Mar 02, 2006, 07:40:54 PM »

Do you want me to write a simple script for that job?

Trial and Error my two best teachers Cool
Join us @ facebook Visit through proxy or twitter Visit through proxy

Last blog : Monetizing Old Posts
OMG!I am geek
**
Gender: Male
Posts: 58
127 credits
Members referred : 0



« Reply #8 on: Mar 02, 2006, 07:51:08 PM »

What job?  "Shortening" the long hand code?  Uhm, sure!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1one
World Wide Whale
***
Gender: Female
Posts: 151
660 credits
Members referred : 0



« Reply #9 on: Mar 02, 2006, 07:56:38 PM »

He means shortening the page upload.

And I never found it that big of a deal, lol.

~Crystal
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 8357
43129 credits
Members referred : 3



« Reply #10 on: Mar 02, 2006, 08:00:14 PM »

That's true is not a big deal, but anyway if you want it here is how is done :

Code:
<?php
$file 
'myfile.css';
 
$css str_replace("\r""",str_replace("\t"""str_replace("\n"""file_get_contents $file )));
$fp fopen$file'w' );
fwrite $fp$css );
fclose$fp );

?>


That's it. Just change the first line with the name of your css file Smiley

Trial and Error my two best teachers Cool
Join us @ facebook Visit through proxy or twitter Visit through proxy

Last blog : Monetizing Old Posts
OMG!I am geek
**
Gender: Male
Posts: 58
127 credits
Members referred : 0



« Reply #11 on: Mar 02, 2006, 09:28:02 PM »

Since I don't understand PHP, I don't get it.

I dont' see any css code in there getting replaced or deleted or whatever.
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 8357
43129 credits
Members referred : 3



« Reply #12 on: Mar 02, 2006, 09:45:16 PM »

Propably you should stay in our forum for a while, and you'll be able to understand php better Smiley

Now about this fragment of code, you just have to edit the line "$file = 'myfile.css'" to whatever your file is (replace the myfile.css to the filename of your css.

Then put this fragment in a php file using a text editor(eg. notepad). Then upload this file to your web server and execute it using your browser(eg. http://yoursite.com/cssremover.php Visit through proxy ) .

You are done Smiley

Trial and Error my two best teachers Cool
Join us @ facebook Visit through proxy or twitter Visit through proxy

Last blog : Monetizing Old Posts
OMG!I am geek
**
Gender: Male
Posts: 58
127 credits
Members referred : 0



« Reply #13 on: Mar 02, 2006, 10:08:03 PM »

But what does it do, specifically?

I may not know php, but I understand technical manuals.  Explain to me what exactly this script does, and if not obvious after that; why should I impliment this? (if i had a long ass css file that is)
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 8357
43129 credits
Members referred : 3



« Reply #14 on: Mar 02, 2006, 10:10:46 PM »

It is opening the file, and removes all the [tab] and [enter] values.

Actually it is almost uselless, but if you have a very big css file it can help as it will reduce the size Smiley

Trial and Error my two best teachers Cool
Join us @ facebook Visit through proxy or twitter Visit through proxy

Last blog : Monetizing Old Posts
OMG!I am geek
**
Gender: Male
Posts: 58
127 credits
Members referred : 0



« Reply #15 on: Mar 02, 2006, 10:30:21 PM »

Oh, it removes WHITESPACE.

I thought it was supposed to check stuff and change things like "10px 0px 10px 0px;" into "10px 0".
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 8357
43129 credits
Members referred : 3



« Reply #16 on: Mar 02, 2006, 10:33:51 PM »

Quote
I thought it was supposed to check stuff and change things like "10px 0px 10px 0px;" into "10px 0".

Even with php which is the best scripting language that can't be done with just one line of code Smiley

But I think that would be a cool open source project : HTML/CSS Optimizer ....
Quote
« Last Edit: Mar 03, 2006, 10:15:54 AM by Nikolas »

Trial and Error my two best teachers Cool
Join us @ facebook Visit through proxy or twitter Visit through proxy

Last blog : Monetizing Old Posts
OMG!I am geek
**
Gender: Male
Posts: 58
127 credits
Members referred : 0



« Reply #17 on: Mar 03, 2006, 04:33:25 AM »

Hell yeah!

I'm glad I thought of it.

Just put my name in the bottom of the code file.
/* Idea by Red Matrix */
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 8357
43129 credits
Members referred : 3



« Reply #18 on: Mar 03, 2006, 10:16:10 AM »

Sure I'll do Smiley

Trial and Error my two best teachers Cool
Join us @ facebook Visit through proxy or twitter Visit through proxy

Last blog : Monetizing Old Posts
Trackback URI for this entry : http://www.webdigity.com/trackback.php?topic=1619
Tags : php css forums open source Bookmark this thread : Digg Del.icio.us Dzone more....

Topic sponsors:
Get a permanent link here for $1.99!


Pages: [1] Print 
Webdigity Webmaster Forums  >  Design and Layout  >  Web Page Design  >  CSS (Moderator: Meth0d)
Topic: Shorthand
« previous next »
Jump to:
User Area
Welcome, Guest. Please login or register.
Did you miss your activation email?
Jan 09, 2009, 06:15:48 AM





Login with username, password and session length

Donate to our community, and get a permanent link back to your site!

Donate to our community, and get a permanent link back to your site!


Forum Statistics
Total Posts: 38.657
Total Topics: 7.772
Total Members: 4.659
Tutorials : 56
Resources : 143
Designs : 220
Latest Member: sardiniasarena

26 Guests, 4 Users online :

16 users online today:



Readers

Web Design Gallery · Whois Lookup · Pagerank · Tag Browsing · Lo-fi version · Syndication · Webmaster forum history · Advertise
Developed by HumanWorks © 2005 - 2009 Webdigity webmaster community · sublime directory
Webdigity Webmaster Forums | Powered by SMF 1.0.12. © 2001-2005, Lewis Media. All Rights Reserved.