473,396 Members | 1,865 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

css optimization

Hi All,

Was wondering what optimizing a style sheet involves? I have a current
style sheet that weighs in at 9 KB. Is this considered large or small? I
tried a couple of these online optimizers. They take out all the white
space and make it next to impossible to read the file. One optimizer
left the css file useless. Good thing I didn't choose the same name as
my original file.

Which format would be better for a css file?

#topcontentright
{clear:right;
width:25%;
height:98px;
padding:0px;
float:right;
margin:0px;}
#topcontentright{clear:right;width:25%;height:98px ;padding:0px;float:right;margin:0px;}

Also is there a hierarchy as far as the order of properties for each
selector?

Thanks for your thoughts,
Patrick
May 16 '07 #1
3 1632
Patrick wrote:
>
Was wondering what optimizing a style sheet involves? I have a current
style sheet that weighs in at 9 KB. Is this considered large or small? I
tried a couple of these online optimizers. They take out all the white
space and make it next to impossible to read the file.
Removing whitespace is hardly optimizing. Well, it's optimizing for size
but even there that's a crude way to do it.
AFAIK there is no tool to actually trim the unused parts out of a CSS
file. The only useful tool here is your brain.
Are you including every style used throughout the site in one CSS file?
Or can you break it up into one common stylesheet and several specific
ones for particular pages?
Which format would be better for a css file?
It depends on which you find easier to maintain.

--
jmm (hyphen) list (at) sohnen-moe (dot) com
(Remove .AXSPAMGN for email)
May 16 '07 #2
In article <f2**********@news1.usf.edu>,
Patrick <ps****@marine.usf.eduwrote:
Hi All,

Was wondering what optimizing a style sheet involves? I have a current
style sheet that weighs in at 9 KB. Is this considered large or small? I
tried a couple of these online optimizers. They take out all the white
space and make it next to impossible to read the file. One optimizer
left the css file useless. Good thing I didn't choose the same name as
my original file.

Which format would be better for a css file?

#topcontentright
{clear:right;
width:25%;
height:98px;
padding:0px;
float:right;
margin:0px;}
#topcontentright{clear:right;width:25%;height:98px ;padding:0px;float:right;mar
gin:0px;}

Also is there a hierarchy as far as the order of properties for each
selector?
If it is not just one or two instructions, consider:

#topcontentright {

clear:right;
width:25%;
height:98px;
padding:0px;
float:right;
margin:0px;
}

This way, the instructions line up neatly on left.

As for order, unless one instruction overrides another, as is in:

p {

margin: 0;
margin-top: 5px;
}
where order is important, the answer is yes.

But for many sets of instructions, order is not important as in:

p {

margin: 0;
padding: 0;
}

However, you need to look out carefully and I can't think of a
general answer.

--
dorayme
May 16 '07 #3
Patrick wrote:
>
Also is there a hierarchy as far as the order of properties for each
selector?
All other things being equal, the last rule wins.
In other cases the more specific rule applies.
"!important" trumps everything else.

--
jmm (hyphen) list (at) sohnen-moe (dot) com
(Remove .AXSPAMGN for email)
May 17 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Alex Vinokur | last post by:
For instance, we need to measure performance of assignment 'ch1 = ch2' where ch1 and ch2 are of char type. We need to do that for different optimization levels of the same compiler. Here is...
9
by: Rune | last post by:
Is it best to use double quotes and let PHP expand variables inside strings, or is it faster to do the string manipulation yourself manually? Which is quicker? 1) $insert = 'To Be';...
5
by: AC Slater | last post by:
Whats the simplest way to change a single stored procedures query optimization level? In UDB8 that is. /F
2
by: Eugene | last post by:
I am trying to set query optimization class in a simple SQL UDF like this: CREATE FUNCTION udftest ( in_item_id INT ) SPECIFIC udftest MODIFIES SQL DATA RETURNS TABLE( location_id INT,...
12
by: WantedToBeDBA | last post by:
Hi all, db2 => create table emp(empno int not null primary key, \ db2 (cont.) => sex char(1) not null constraint s_check check \ db2 (cont.) => (sex in ('m','f')) \ db2 (cont.) => not enforced...
24
by: Kunal | last post by:
Hello, I need help in removing if ..else conditions inside for loops. I have used the following method but I am not sure whether it has actually helped. Below is an example to illustrate what I...
21
by: mjbackues at yahoo | last post by:
Hello. I'm having a problem with the Visual Studio .net (2003) C++ speed optimization, and hope someone can suggest a workaround. My project includes many C++ files, most of which work fine...
5
by: wkaras | last post by:
I've compiled this code: const int x0 = 10; const int x1 = 20; const int x2 = 30; int x = { x2, x0, x1 }; struct Y {
2
by: db2admin | last post by:
hi, I have query which runs great when optimization level is changed to 3 but does not run fine with default optimization level of 5. since this is a query in java code, i do not know how can i...
20
by: Ravikiran | last post by:
Hi Friends, I wanted know about whatt is ment by zero optimization and sign optimization and its differences.... Thank you...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.