Previous Message
Next Message

Re: Abbreviating Stylesheet was Re: [css-d] Liquid DIV

Sent by Xian on 25 June 2002 12:12


On 6/25/02 10:37 AM, "lon.kraemer" [EMAIL-REMOVED]> wrote:
> Next, I want to pull the CSS from the page so's I can hide it from NN4,
> et al.
> 
> File size wise, I've saved only about 1K against the table based page.
> So, looking at the style block, what might be done to "shorten" it?

Remember to use the cascading feature of CSS.
Say for example, all of your divs in #headrow are 50px X 50px

Instead of writing that in the selector for every div. Use an element
selector to select all of the divs that are descendant of #headrow

#headrow div {
    width:50px;
    height:50px;
    }

Then you can use the individual div selectors to just change the background
color.

Also for you are using white borders in a lots of cases where margins would
work just as well. As your background it white.
This saves a lot of space because if you use margins you don't have to use
the box-model hack.

One more thing, it is not necessary to wrap your images in divs, you can set
them to display:block and apply styles directly to them.

Just using these tricks I was able to cut your headrow CSS from 50lines down
to 20.

Here it is so you can see how it works.
http://rupert.homeunix.com/test/layoutage/testage/cityremodal.html
Previous Message
Next Message

Message thread: