HTML If Conditions & Statements

Published September 16th 2009
Filed under HTML

Like Java and other programming languages, HTML also has its own set of If Conditions and Statements. They’re really simple to use and are useful if you want to have a page look the best it can in different browsers.

For example, Internet Explorer 6 and below can’t handle transparent PNG images but Internet Explorer 7 and above can, so you may want to remove the transparent PNG in Internet Explorer 6 and below.

To do this, you can use the following If Statements:

<!--[if gt IE 7]>
<TABLE style="background: url(images/gradient.png);" BORDER="0" CELLPADDING="0" CELLSPACING="0">

This code is read as it’s written. It means if the browser you’re using is greater than Internet Explorer 7, use the PNG image background. Internet Explorer 6 and below will not use the PNG background.

Read the rest of this story »

Redirecting Webpage To WWW Prefix

Published May 24th 2009
Filed under HTML

When a domain is entered in a browser, it can be entered with or without the www prefix. For example, can be reached from either or Search engines will pick this up as 2 different webpages which will half your ranking on the search engines search results. There is a way to make make it a single webpage using a redirection. You must choose to either use the www prefix or not. To do this, make a new .htaccess file or edit an existing one in the root of where your site is hosted. In the .htaccess file, enter the following replacing the url with your own:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^www\.let-go\.net [NC]
RewriteRule ^(.*)$$1 [L,R=301]

Save the file and upload it. This will redirect your site to the www prefix when the prefix is not entered making it one webpage on search engines. To redirect it to exclude the www prefix, take out “www\.” and the “www.” in the code above.

Creating Extra Block Headers

Published April 07th 2009
Filed under CSS, HTML

By default, html has 6 predefined headers which can be used by putting the number of the header inside the code around the header like this: <H1>Title</H1> up to <H6>Title</H6>.

These headers all display in block form as default which is invisible until a background is given to the header.

If you’ve run out of headers you can create your own by putting adding css style to your text but when you try doing this, you’ll notice that the custom header won’t display in block form.

To fix this, you need to define the block form in the style. This can be done like this:

<P style=”display: block;”>Text</P>

Following “display: block;” will be the rest of the style you want to give the header such as backgrounds, fonts, font colors and alignment.

Link Targets

Published April 06th 2009
Filed under HTML

There are 4 main targets that a hyper link can use. They are:

  • TARGET=”_blank”
  • TARGET=”_self”
  • TARGET=”_top”
  • TARGET=”_parent”

TARGET=”_blank” is the most useful. It opens the link in a new window or tab depending on the browser in use. TARGET=”_self” opens the link in the current window but is rarely¬†used because omitting the target code altogether will open the link in the current window also so there is no need to put it in.

You can also create your own targets by defining frames on your page with different names which is what TARGET=”_top” and TARGET=”_parent” are similar to. The only difference is Top and Parent are predefined.