In order to optimize web pages and speed up web page downloads, in addition to optimizing images, we also need to optimize other elements of the web pages. If you can make full use of editing tools during the web weaving process, you can also achieve optimization purposes in web production. Here are some optimization techniques in Dreamweaver:
Whenproperly calling CSS
for web design, using style sheet CSS to arrange page elements can greatly reduce HTML code. We already know this.
Method:
(1) Select the object and select the defined style from the right-click menu to add it; (2) Select the style for the object from the style panel;
(3) Right-click a label on the label selector Choose a style.
Although the page effects obtained by these three methods are the same, since the first method will generate a "span" tag in the HTML code, if used excessively, it will greatly increase the fatness of the web page source file and affect the download speed. Therefore, when calling CSS, the second and third methods should be used.
Reduce the load on the server
. In interactive web pages, users often submit data to the server through forms, wait for the data to be processed by the server, and return to the browser... The waiting process is very annoying. For this reason, when we edit web pages, we also need to consider the server. When creating web pages in Dreamweaver, one of the best things that can reduce the load on the server is to verify the legality of the form submitted by the user. It only needs to be done on the browser side without returning to the server for verification, which not only reduces the load on the server, but also reduces the load on the server. burden, and make the viewer less sad to wait. Method: Select the form, open the "Behaviors" panel, click the "+" sign to select "ValidateForm", and then set it. By the way, please note that this verification process actually uses JavaScript for verification on the browser side. When performing the above operation in Dreamweaver, it will place this JavaScript code in the header and middle of the web page, which will definitely make the full display time of the page longer, because the browser must download this code first before downloading other page elements. . Therefore, it is best to open the code editor in Dreamweaver, cut and paste this script to the end of the source code, and let it download at the end. In addition, when we add JavaScript script effects to the web page, if you don't want it to take effect immediately when the page appears, you may as well set it up like this.
Self-"Lose Weight"
There are currently many "weight loss teas" on web pages, and we can find them everywhere. In Dreamweaver, we don't have to look for "weight loss tea" everywhere. Using its own "weight loss" function can make web pages "slim and pleasant".
Method: Select "Clean upHTML" under the "Commands" menu to set up the settings to clear redundant code on the web page.
By rationally applying tables,
we not only need to reduce the load on the server, but also reduce the load on the browser we use, that is, we must shorten the browser's parsing time for the page as much as possible. The addition of the JavaScript script mentioned above is an example. What also affects the browser's parsing of the page is the table, because the browser's parsing time for the table is proportional to the size and complexity of the table, and for the layout arrangement in Dreamweaver, we add a large number of tables for positioning. , some people even include multiple small tables in a large table, which essentially increases the burden on the browser and greatly lengthens the page rendering time. For this reason, when using tables, the tables should be broken up as much as possible, and the tables should be avoided as much as possible.