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">
<![endif]-->

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 »

Portfolio Update & New Annie Layout

Published September 15th 2009
Filed under Portfolio

I’ve updated my Portfolio to include all the recent layouts I’ve made. You can check them out by clicking here. I’ve also added a new layout to Anniemaniac which you can view by clicking on the picture below:

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, Let-Go.net can be reached from either let-go.net or www.let-go.net. 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 Let-Go.net url with your own:

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

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.

How To Center A DIV Element

Published May 16th 2009
Filed under CSS

Centering a DIV Element doesn’t work the same as centering everything else. Using style="text-align:center" doesn’t work. There is still a way of centering it. You have to use the following css code:

style="width: 600px; margin-left: auto; margin-right: auto;"

Set the width to whatever you want it to be and it centers the DIV Element as you want it to.

Backgrounds

Published April 19th 2009
Filed under CSS

There are a few different ways to place a background image using a Cascading Style Sheet (CSS). These include:

  • repeat (repeats the image all over the page)
  • repeat-x (repeats horizontally)
  • repeat-y (repeats vertically)
  • no-repeat (doesn’t repeat so the image only appears once)
  • fixed (stays in position so that the background doesn’t move when scrolled)

The background can also be placed more specifically such as:

  • fixed repeat top left
  • fixed repeat-x

These are useful because putting a background on a page using standard html doesn’t always display the background as you want it.