Creating Nice Lists in HTML and CSS

When creating lists in HTML and CSS you can create a numbered list or an unordered list of items. There are three tags that you need to know in order to create a list.

The tags you need to know are <ul> for an unordered list, <ol> for an ordered or numbered list, and <li> which is used for the list items.

So let’s say you have a list of items you want to display with two values for each item. For example a list of names and email addresses.

The unordered list would look like this:

  • John Doe jdoe@somedomain.com
  • Jane Doe janedoe@someotherdomain.com
  • Joan Doe joan@somedomain.com

The HTML would look like this for the above list:

<ul>
<li>John Doe <span id=”email” >jdoe@somedomain.com</span></li>
<li>Jane Doe <span id=”email”>janedoe@someotherdomain.com</span></li>
<li>Joan Doe <span id=”email”>joan@somedomain.com</span></li>
</ul>

Notice the unordered list has a little arrow next to it.  To acheive this style.  You’ll need an image of an arrow and also some CSS code.

ul li {
list-style: none;
line-height: 20px;
background: url(‘images/orange_bullet.gif’) no-repeat 0px 7px;
font-weight: bold;
}

The ordered list would look like this:

  1. John Doe jdoe@somedomain.com
  2. Jane Doe janedoe@someotherdomain.com
  3. Joan Doe joan@somedomain.com

The HTML for the above ordered list would look like this:

<ol>
<li>John Doe <span id=”email”>jdoe@somedomain.com</span></li>
<li>Jane Doe <span id=”email”>janedoe@someotherdomain.com</span></li>
<li>Joan Doe <span id=”email”>joan@somedomain.com</span></li>
</ol>

Now in order to get the bold look with the blue email text you’ll need to add a few more lines to your CSS like below.

#email {
color: #1A2F8F;
}

Here is the complete code with the CSS and the HTML for both lists.

<style>
ul li {
list-style: none;
line-height: 20px;
background: url(‘images/orange_bullet.gif’) no-repeat 0px 7px;
font-weight: bold;
}
ol li {
font-weight: bold;
}

#email {
color: #1A2F8F;
}
</style>

<ul>
<li>John Doe <span id=”email” >jdoe@somedomain.com</span></li>
<li>Jane Doe <span id=”email”>janedoe@someotherdomain.com</span></li>
<li>Joan Doe <span id=”email”>joan@somedomain.com</span></li>
</ul>

<ol>
<li>John Doe <span id=”email” >jdoe@somedomain.com</span></li>
<li>Jane Doe <span id=”email”>janedoe@someotherdomain.com</span></li>
<li>Joan Doe <span id=”email”>joan@somedomain.com</span></li>
</ol>

Posted in Tips and Tricks | Leave a comment

How to Use Contextual Links

Learn how to use contextual links to your website so that you can achieve better listings on search engines. Using this strategy can also bring you more free and targeted traffic.

So what is a contextual link?

A contextual link is a link that contains the primary keyword phrase of the page you want to link to. For example if I want to link to this article then I would create a link that may look like this.

Contextual Links

<a href=”http://www.createbetterwebsites.com/how-to-use-contextual-links.html”>Contextual Links</a>

I’ll use this link throughout my own site when I want to link back to this article and also on any other website or external link building strategy. This will help my page rank well and come up near the top for that particular keyword, contextual links in this case.

But this will only help get good rankings if the keyword you use in the link is also the focus of the page you are linking to. In other words the content of the page has to be about contextual links in this case and not about hosting or dogs. You can’t trick the search engines. If you try you will get penalized.

Just remember to use contextual links whenever you can to link back to your web pages, whether it’s an internal link (from your own website) or external link (from another website).

Use this technique and you’ll create a website that ranks well in the search engines and gets free organic traffic.

Posted in Tips and Tricks | Tagged , | Leave a comment

CSS Color Codes




Posted in Tips and Tricks | Leave a comment

CSS Background Image Codes

Below are some sample CSS background image codes for displaying a fixed background image on a website.

If you want an image to scroll with your web page use the code below. Replace filename.jpg with your image name and make sure you put the correct path to the image as well.

body {
background-image: url(filename.jpg);
background-attachment: scroll;
background-repeat: no-repeat;
}

You can also make the background image to be fixed, so when you scroll the webpage up and down, the background image stays static and doesn’t move. Replace filename.jpg with your image name and make sure you put the correct path to the image as well.

body {
background-image: url(filename.jpg);
background-attachment: fixed;
background-repeat: no-repeat;
}

If you are using a single image for the background make sure it’s large enough to cover you web page. You can also use a small image and repeat it horizontally or vertically.

Posted in Tips and Tricks | Tagged | Leave a comment

Canonical Link Element

So what is a canonical link element or canonicalization?

It’s a link element, an open standard, and is supported by Microsoft, Google, Yahoo.

A canonical link element is a way to define a canonical page which is the preferred version of a set of pages with very similar or duplicate content.

It fixed all the cracks and mistakes developers make in their code.

Make all your internal links consistent. Make sure your URL’s are standardized or normalized. In other words don’t have different versions of your URL’s in your internal linking.

For example all of the URL’s below can be the same exact page but search engines will be confused and see them as different pages even if they return the same content.

Because in practice they can actually return different content depending on the content management system and the web server.

www.yourdomain.com
www.yourdomain.com/index.html
www.yourdomain.com/
www.yourdomain.com/index.html/
index.html

The best thing maybe be to always use absolute URL’s. For example always point to your home page like so…

http://www.yourdomain.com/index.html

This way you are consistent and you don’t confuse the search engines and seem like you have duplicate content.

If you do have different internal linking and or duplicate content that you can’t fix it then you use the canonical link element in your web pages.

The way to specify the canonical page is to insert the link element like this ..

<link rel=”canonical” href=”http://www.domain.com/index.html”/>

You can self-reference a page. Meaning you can insert the above link element in your index.html page and on any page that duplicates the index.html. When you insert it in index.html it’s a self reference.

One of the biggest issues I’ve seen with code and with content management systems sometimes is that the entire site points to the main page. So all pages are pointing to the index page.

This can be detrimental to a site. I’ve seen this happen and the entire site is not indexed except for the index.html. So what do you do in this case? Remove the line of code and resubmit your website to the search engines.

Here is an article on How to Remove Canonical Link Element From Multiple Files.

Posted in Tips and Tricks | Tagged , | 1 Comment