iSnare.com - Free Content Articles Directory
Authors Contents [Advanced Search][Add OpenSearch][Job Search]
Distribute your articles to thousands of article sites for only $2 and below! Read more...

Index  Internet
 

The Three Principles Of HTML Code Optimization

 
[ Contact the Author] [ Send to a Friend] [ Article Publisher] [Make PDF] [ Print] [ Bookmark & Share]
 
Read our Terms of Service before reprinting this article. The submitter specified above has claimed the rights to this article.
George Peirson

Just like spring cleaning a house, the html code of your web pages should get periodic cleaning as well. Over time, as changes and updates are made to a web page, the code can become littered with unnecessary clutter, slowing down page load times and hurting the efficiency of your web page. Cluttered html can also seriously impact your search engine ranking.

This is especially true if you are using a WYSIWYG (What You See Is What You Get) web design package such as FrontPage or Dreamweaver. These programs will speed up your web site creation, but they are not that efficient at writing clean html code.

We will be focusing this discussion on the actual html coding, ignoring other programming languages that may be used in a page such as JavaScript. In the code examples I will be using ( and ) characters instead of correct html so that the code examples will display properly in this newsletter.

Up until recently when coding a page in HTML we would be using tags such as the (font) tag and (p) paragraph tags. Between these tags would be our page content, text, images and links. Each time a formatting change was made on the page new tags were needed with complete formatting for the new section. More recently we have gained the ability to use Cascading Style Sheets, allowing us to write the formatting once and then refer to that formatting several times within a web page.

In order to speed up page load times we need to have fewer characters on the page when viewed in an html editor. Since we really do not want to remove any of our visible content we need to look to the html code. By cleaning up this code we can remove characters, thereby creating a smaller web page that will load more quickly.

Over time HTML has changed and we now have many different ways to do the same thing. An example would be the code used to show a bold type face. In HTML we have two main choices, the (strong) tag and the (b) tag. As you can see the (strong) tag uses 5 more characters than the (b) tag, and if we consider the closing tags as well we see that using the (strong)(/strong) tag pair uses 10 more characters than the cleaner (b)(/b) tag pair.

This is our First Principle of clean HTML code: Use the simplest coding method available.

HTML has the ability of nesting code within other code. For instance we could have a line with three words where the middle word was in bold. This could be accomplished by changing the formatting completely each time the visible formatting changes. Consider this code:

(font face=”times”)This(/font)
(font face=”times”)(strong)BOLD(/strong)(/font)
(font face=”times”)Word(/font)
This takes up 90 characters.

This is very poorly written html and is what you occasionally will get when using a WYSIWYG editor. Since the (font) tags are repeating the same information we can simply nest the (strong) tags inside the (font) tags, and better yet use the (b) tag instead of the (strong) tag. This would give us this code (font face=”times)This (b)BOLD(/b) Word(/font), taking up only 46 characters.

This is our Second Principle of clean HTML code: Use nested tags when possible. Be aware that WYSIWYG editors will frequently update formatting by adding layer after layer of nested code. So while you are cleaning up the code look for redundant nested code placed there by your WYSIWYG editing program.

A big problem with using HTML tags is that we need to repeat the tag coding whenever we change the formatting. The advent of CSS allows us a great advantage in clean coding by allowing us to layout the formatting once in a document, then simply refer to it over and over again.

If we had six paragraphs in a page that switch between two different types of formatting, such as headings in Blue, Bold, Ariel, size 4 and paragraph text in Black, Times, size 2, using tags we would need to list that complete formatting each time we make a change.

(font face=”Ariel” color=”blue” size=”4”)(b)Our heading(/b)(/font)
(font face=”Times color=”black” size=”2”)Our paragraph(/font)
(font face=”Ariel” color=”blue” size=”4”)(b)Our next heading(/b)(/font)
(font face=”Times color=”black” size=”2”)Our next paragraph(/font)

We would then repeat this for each heading and paragraph, lots of html code.

With CSS we could create CSS Styles for each formatting type, list the Styles once in the Header of the page, and then simply refer to the Style each time we make a change.

(head)
(style type="text/css")
(!--
.style1 {
font-family: Arial, Helvetica, sans-serif;
font-weight: bold;
font-size: 24px;
}
.style2 {
font-family: "Times New Roman", Times, serif;
font-size: 12px;
}
--)
(/style)
(/head)
(body)
(p class="style1")Heading(/p)
(p class="style2")Paragraph Text(/p)
(/body)

Notice that the Styles are created in the Head section of the page and then simply referenced in the Body section. As we add more formatting we would simply continue to refer to the previously created Styles.

This is our Third Principle of Clean HTML Code: Use CSS styles when ever possible. CSS has several other benefits, such as being able to place the CSS styles in an external file, thereby reducing the page size even more, and the ability to quickly update formatting site-wide by simply updating the external CSS Style file.

So with some simple cleaning of your HTML code you can easily reduce the file size and make a fast loading, lean and mean web page.

Important NoticeDISCLAIMER: All information, content, and data in this article are sole opinions and/or findings of the individual user or organization that registered and submitted this article at Isnare.com without any fee. The article is strictly for educational or entertainment purposes only and should not be used in any way, implemented or applied without consultation from a professional. We at Isnare.com do not, in anyway, contribute or include our own findings, facts and opinions in any articles presented in this site. Publishing this article does not constitute Isnare.com's support or sponsorship for this article. Isnare.com is an article publishing service. Please read our Terms of Service for more information.

George Peirson is a successful Entrepreneur and Internet Trainer. He is the author of over 30 multimedia based tutorial training titles covering such topics as Photoshop, Flash and Dreamweaver. To see his training sets visit www.howtogurus.com Article copyright 2005 George Peirson
Article Tags: code [See Dictionary], html [See Dictionary], page [See Dictionary]
Got a question about this article? Ask the community!
Article published on June 29, 2005 at Isnare.com
 
Rate [Ratings: 5 / 5] [Votes: 1]

SEO Primer - 7 Basics of SEO
Submitted by: George Peirson

We are going to look at 7 Basics of SEO below These aren’t the only things you want to know about SEO, but are the areas you should learn first...

7 Basics of Good Web Design
Submitted by: George Peirson

Whether you are just starting a web design project, looking at revamping an existing site, or just wanting to double check the usability of your current web site you should consider these 7 Basics of Good Web Design...

Finding A Good Ebay Seller And How To Spot The Bad Ones
Submitted by: George Peirson

EBay is possibly the largest online market place, with millions of transactions happening every day You can find just about anything imaginable on eBay, from that toy you remember fondly from your childhood, to cars and houses...

Keyword Lists – Their Proper Care And Feeding
Submitted by: George Peirson

One of your most important marketing assets is your Keyword List But are you giving your Keyword List the attention it deserves...

Flash Tricks For Improved Search Engine Rankings
Submitted by: George Peirson

Normal wisdom says that if you use Flash in a web site it will hurt your search engine placement This is due primarily to search engines having a hard time to index Flash content...

How To Use Flash In Your Site And Still Be Search Engine Friendly
Submitted by: George Peirson

Do you want to have a feature rich web site with animations, sound, and an opening splash screen Do you want to use Flash extensively on your site but you are afraid of hurting your search engine positioning...

The Five Ways You Should Be Using Keywords
Submitted by: George Peirson

We have all read lots of articles on how to gather keywords, how to compile a huge keyword list, how to make these keywords relevant to our web site...

Using External Coding To Improve Search Engine Placement
Submitted by: George Peirson

Do you have lots of JavaScript coding in the header section of your web pages Do you re-list your CSS styles at the top of every page...

Is Spyware Slowing Your Computer Down To A Crawl?
Submitted by: George Peirson

Everyday more and more computers are becoming infected with Spyware and Adware (advertising tracking)...

The Three Principles Of Image Optimization
Submitted by: George Peirson

Are you losing visitors to your web site due to slow page load times Is your site being penalized because the images on your site are too large...

Get Unexpected Growth With the Help of a Search Engine Marketing Firm
Submitted by: Steve Waganer

Usually, businesses that step into online market with a well established offline business strategy believe that they do not need to make any effort for grabbing attention of online consumers...

Make Easy Money as a Clickbank Affiliate
Submitted by: Sorabh Tondon

Don't you want to laugh at some of the ads you see "Make easy money as a Clickbank affiliate"...

About Artful Blogging
Submitted by: Indrani Sarkar

Finding specific information about artful blogging might not be easy, but we have gathered very helpful and relevant information about the general subject matter, with the ultimate aim of assisting you out...

Optimizing Your Affiliate Pages
Submitted by: Diana White

With no doubt, Affiliate Marketing is one of the most rewarded jobs in the Web However, it is not an easy field to rank due to the raising competition...

What’s the Difference?
Submitted by: Andy Crestodina

Any company that has looked into getting a new website will tell you that the price range can be enormous… A few thousand dollars...

Search First, Ask Questions Later
Submitted by: John Cooney

Searches are an extremely important feature for most sites, as the first step of every user task is finding where to begin...

Designing the Best Website
Submitted by: Andrew L Perkins

What is the best website design for your company In fact, designing the best website may be entirely different from what others choose...

Graphic Design Principles
Submitted by: Andrew L Perkins

Depending upon your business, you may not realize your need for graphic design Also, you may have a graphic design need you’re not aware of...

Logo Design Principles
Submitted by: Andrew L Perkins

Think of some logos which are easily recognizable You know the ones: McDonald’s, Apple, Coca-Cola and others...

Web Site Design Principles
Submitted by: Andrew L Perkins

If you look around the internet, you’ll see websites of every kind You’ll see some which are well-designed while others may look like they’ve been thrown together...

Why You Need a Visually Appealing Website
Submitted by: Andrew L Perkins

You may have seen websites which have left you wondering “what on earth were they thinking” There’s so much information on the page you can’t make heads or tails out of the content and you can’t find your way from one page to the next...

How Would Effective Backlinks Help You in Online Business?
Submitted by: Michael D. Lee

Are you looking for alternate methods of earning money Are you completely depressed about the recession and your business-let downs...

Make the Best Out of On-line Social Networking
Submitted by: Michael D. Lee

Each and every day and moment, there has been several discoveries and inventions with respect to the world of Internet as a lot of technologies and concepts are continuously coming up as and when possible...

Right Information About SEO Services
Submitted by: Chris Carter

The Internet actually has completely brought the whole world close together and rightly has transformed it just into a simple small village...

How You Get A Website - Everything You'll Need To Know To Get Your Idea On The Web
Submitted by: Jason OConnor

If you want to get online and are wondering, "How can I get my idea live on the Web in the form of a website...

Isnare.com Footer Divider

© 2004-2009. Isnare Free Articles - An Isnare Online Technologies Free Articles Project. All Rights Reserved.   Privacy Policy