Forum Moderators: open
There was some discussion on the boards about reducing file sizes of web pages and "Frontpage" bloat. I used Frontpage when doing my website (my first!) and ended up taking out alot of what Frontpage put in in order to get things to validate. Is there something specific to look for in the code that will reduce the file size?
My pages are table based with graphics in each cell. I successfully reduced the file size about 15-20% and things do load quicker. I just wondered what short-term things I could do to reduce the size and also what I should be looking at doing long term (when I get up enough guts to revise my site) to reduce my file size. I have Dreamweaver 4 that I could install and try to learn. What about learning a different type of HTML?
Also, I saw a site that seemed to load graphics from a CGI-BIN. Does this keep the page sizes down?
Thanks for any advice.
Palmpal
Have you ever seen font tags opened with color, size, font-family...the whole nine yards...only to close after a single -- all that was needed was perhaps <br> or two.
Or how about layout tables where every <td> has width and height attributes? The entire row can only have one height, after all, and the entire table column only one width.
The biggest problems I've seen with code bloat come from two areas:
1. Thinking of HTML as a layout program and then sticking in whatever you want, and wherever you want, just to get your browser to give you the look you want.
2. Trying too hard to control what the browser is going to do, down to the pixel.
HTML isn't about the look or the visual structure, it's about the content and the logical structure. The look should be handled mostly with CSS. Once you catch CSS fever, you start to get much clearer about how to use HTML in the manner it was planned. And code bloat starts to scream at you.
To reduce the size of table images, you need to break them up. Like say you want the top part of your document to have a top border that is 700px wide with rounded edges. Instead of making the whole graphic 700 px, you just break it up into three separate sections (td's), (left, middle, and right). In the left cell would be a rounded corner, in the middle would just be the background color and nothing more, and in the right cell would be another rounded corner. You've just reduced an image that would have been a whole 700px wide image into maybe say two 50-80 pixel wide images, saving tons of loading time and file size, and you get the same effect.
Now I know this was an easy example, but maybe if you post a link to your site we can see what configuration of tables you have and how to break up the images so they load faster.
<!--"The look should be handled mostly with CSS. Once you catch CSS fever, you start to get much clearer about how to use HTML in the manner it was planned. And code bloat starts to scream at you."-->
I agree, CSS is amazing for organizing your site and making it easier to code. The only thing I disagree with using CSS for is tables, since you are really only complicating yourself with trying to do it the "easier" way while you are overlooking the most efficent way of doing it. CSS is great for everything else though :)
Web design is something that should be thought about and planned out, not just made fast by clicking on some buttons... When something goes wrong with the program or it doesn't give you the effect you want, then you won't really know what to do because you are too dependent. Given, I could make 10 decent web pages in a short period of time with an editor, but I would rather make one extremely well done web page that is thought out and planned out well in that same time period. And also when you do it by hand, you develop your own style, so if anything goes wrong you can read and find out what went wrong, instead of going through the source clueless about what is happening and trying to decipher unfamilar code when you use an editor.
Palmpal
You can touch it ;)
>>>>I just wondered what short-term things I could do to reduce the size
If you are using FP and FP by default, you might want to tinker aroundw with that before it contributes any more unncessary code into the mix.
I just opened FP 2002 and "drew" a table
<div align="left">
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="360" height="157" id="AutoNumber1">
<tr>
<td width="360" height="157"> </td>
</tr>
</table>
</div>
Obviously that code is fat, and you dont want to have to keep editing it.
I'd make yourself some code templates that you can cut and paste into your pages so you dont have to keep working against code bloat.
Then when you find out more about the mystical advances of CSS and the like, and your templates still have "extra" code, you can strip down the templates quickly using CSS and keep the code lean and easy to access when needed.
The topic has came up a few times over a couple of weeks, you mentioned reading one of em, you might have missed one :) They were both pretty comprehensive.