How To Optimize The HTML Codes

You can optimize those codes and also other codes, for example CSS or PHP, in order to help the browser, which will load your pages to load less codes than it would normally would. For example, in an HTML page you don’t need to place almost any attribute, property and value that you know and insert speciffic values, that are not by default, to not make the broswer think.

You should do this something in between. This means that you have to tell the browser that your layout is red and you have to mention that, not let the browser “think” by itself that the background-color is white and the letters used in your text are black, as normal. You can set the color of your text, of your tables, borders, frames and so on.

Just when you do this, make sure you will not write about every property that you know. For example, you could skip text-decoration, if this is unimportant to your content. If you want to present something to your audience and if the attribute is requested for a special job, you can use it, but in this, you should not use too many other attributes, which explain almost the same thing. You can write in text, or you can skip it, because some of the attributes in the HTML language are not even used by programmers. If you own a site which teaches people who want to learn programming, it is better to use the text and the codes also. But you should skip the images in that case. You can insert more videos, because they will be better appreciated by your readers or viewers, in that case.

For example, a CSS code can be optimized in this way. Instead of writing the code to express more values of different attributes, you can write the attribute and then the values, you can place them one by one in the value tag. If you write about background, you can write the color and the image and the fact that the image is repeated or not and fixed or not, in the same value row. So, you will not write background-color: “red” and background-repeat: “no”. You will write these values one by one after you write the background attribute, like this: background: “red no repeat”.

You have to know the order in which you can place those values, because if a value comes before another one, it will not be recognized by the browser, since in that location you had to place the value about the size of the margin, for example, not the color of the margin. If the browser sees that the size of the left margin is red, instead of 10 pixels, for example, it will not show a thing. This depends very much on the browser, but I know that this usually happens when you write the code wrong. Luckily, there are text editors, which show you where you have put the mistake and you can re-write the code.

Also, you can use a tool, called CleanCSS, which removes useless properties after you have selected them. It is wise to use the CSS codes in an external sheet. This is my opinion. I know those sheets are connected to the site as well, but at least the browser won’t see them in the same page as the page that they load.

Topics: , , , , , , , ,

Did you like this? Share it:

Watch tweets on:
  • You may also like

    1. Picture: Why Do We Have To Use HTML?

      Why Do We Have To Use HTML?

      I found a series of interesting articles that talk about the same subject, which is the most importa...

    2. Picture: What HTML Editor To Use

      What HTML Editor To Use

      I said somewhere in the introduction of HTML that the browser requests an HTML code from server. A w...

    3. Picture: How To Work With HTML Frames

      How To Work With HTML Frames

      The frames are used by Web designers when they want the homepage to have an appropriate structure an...

    4. Picture: What is HTML?

      What is HTML?

      One of the first fundamental elements of the WWW (World Wide Web) is HTML (Hypertext Markup Language...

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>