Saturday, February 16, 2008

Building a Mouse - Over Menu Using CSS

Introduction

I remember when I started building web sites. Creating a dynamic menu’s meant creating a series of images: one for the static image, one for the mouse-over image, and at times a separate image for when a click occurred. After this, I piled on the JavaScript to preload the mouse over images and change the images, depending on which menu button had the mouse cursor over it. Phew! It was a lot of work.

This in itself was tedious. Not only because I had to create up to 3 separate images, but also because it increased page load time, as well as being a pain when the time came to create a new menu item for the same site. With the evolution of CSS over the past couple of years, however, this process has been greatly simplified.

In this article I’ll show you a very simple technique to create mouse over menu’s that load almost instantly, that look great, and that are very easy to maintain.

Anyway, let’s get started!

The Finished Product

Before I get started, here’s a picture of what the end result will look like. Keep in mind that you can easily change the fonts, sizes, colorsto match your web sites look and feel.



Search Engines Care

If you’ve been involved in any form of search engine optimization then you’ll know that search engines use links quite heavily to determine search rankings and relevancies.

Why does this matter? Simply because using text or style sheet driven menu’s mean search engines such as Google can read your links. If we used images for our menus,
Google would know there’s a link, but it wouldn’t be able to index the actual words used to create the link.

Building the Menu

Building the menu is a simple process. First, we’ll start by creating the background of the menu. This is the dark gray bar that you can see above.

Insert this div inside the body tags of your web page, where you want the menu to appear:

<div class=toolbar></div>

Next, create the stylesheet class for the toolbar and add it before the closing </head> tag in your web page:

<style>

.toolbar {
background-color: #313031;
padding: 5px 0px 5px 0px;
}

</style>



We added some padding to the top and bottom of the toolbar div tag to create some spacing between the text and the background border.

Notice the following expression in the style sheet:

padding: 5px 0px 5px 0px

Here, we’re setting the padding on the top, right, bottom and left sides of the div respectively.


Now we’ll place some menu links inside of the toolbar div, and then add some CSS to format the links, thus emulating that menu button look that we’re after:

<div
class=toolbar><a class="menu" href="menu1.html" title="Visit Menu
Item 1">&nbsp;Menu Item 1</a></div>



The title tag causes a tool tip to be displayed when the cursor is placed over the link (or menu button). Here’s the CSS to create the basic menu buttons:

.menu {
border-right: 1px solid white;
text-decoration: none;
background-color: #313031;
padding: 5px;
}





Here, we simply place a border on the right side of each button to create the 1 pixel of white space which acts as a separator between menu items.

We then remove the underline from each link, by using the text-decoration: none attribute. Finally, we replace the background color of the menu item to match the background color of the toolbar div and add a padding of 5 pixels to create our menu button.

Whilst this works, it obviously doesn’t look very pretty. So let’s add some formatting to the text of the buttons:

.menu {
border-right: 1px solid white;
text-decoration: none;
background-color: #313031;
padding: 5px;
color: white;
font-family: Tahoma;
font-size: 8pt;
font-weight: bold;
}




Ah. Much better! We’re almost done -- all we need now is the mouse-over color change. Whilst this used to involve Javascript and can still be done using some simple Javascript code, I find it easier to use the CSS hover attribute, which basically defines the look of a link when the mouse cursor moves over it:

.menu:hover {
background-color: #5A8EC6;
}


Remember that the hover attribute only works on links, i.e. <a href…></a> tags.

We’re done

That’s really all there is to it! We can now add more link tags to create the rest of the menu. The complete code looks like this:

<style>
.menu {
color: white;
font-family: Tahoma;
font-size: 8pt;
font-weight: bold;
border-right: 1px solid white;
text-decoration: none;
background-color: #313031;
padding: 5px;
}

.menu:hover {
background-color: #5A8EC6;
}

.toolbar {
background-color: #313031;
padding: 5px 0px 5px 0px;
}

</style>


<div class=toolbar><a class=menu href="menu1.html" title="Visit Menu Item 1">&nbsp;Menu Item 1</a><a class=menu href="menu1.html" title="Visit Menu Item 2">&nbsp;Menu Item 2</a><a class=menu href="menu1.html">&nbsp;Menu Item 3</a></div>


And there you have it. A complete menu for your next website, in only a few lines of code!

Wednesday, February 13, 2008

Few Steps to Increase your Google Page Rank

Page Rank of a website is a asset for a site owner, because if a site has a larger page rank it will be more visible in search engines and can get more visitors. There are a lot of ways to promote your website and increase its page rank. Some ways require you to pay for it and some are FREE but needs extra time and efforts. Remember in Websites the most important thing you need to remember is the patience. Below are some points which you can follow and improve your website ranking.

  1. Linking is the best and fast way to improve your page rank. Try to get a link back from higher page rank websites. There are some free ways also but they will take a long time to insert your link in other websites. But if you can pay some $$ to get a link back from higher page rank websites, they will guarantee you for your link to be approved within a week.
  2. If you are planning to purchase a link back then remember this point, some websites have PR4, PR5 or even PR7 for their home page, but no PR for any of their other pages, So remember to pay for only that link which will be displayed on a PR+ page.
  3. Submit to directories and sit relax. Start one by one and submit your link in all web directories. If you can, try to give a link back (reciprocal link on your page) to free directories, some directories does not need it, but if you provide them, their owners will look for your approval first.
  4. Build a sitemap for your website (XML based for Google and text based for yahoo) and submit them to Google and yahoo. Get a Google webmaster account and sign in there to see your website statistics. It will also tell you if you site is indexed or not, and your page rank in Google.
  5. Update your website every day by adding more unique content. If you site has some information for a visitor then it is 100% chance for him to come back to your site again.
  6. Provide inside linking to your website. For example you can provide a link of your previous and next articles on an article page. Or you can provide a list of related articles so visitor can remains a long time on your website.
  7. Keep in touch with your website. If you do, you will get results from your statistics analyzer very soon that you are getting visitors and your page rank is improved.
  8. And the most important tip. “Trade your link with other web owners“. Put their link on your website and they will put your link in them. This is for free and the very fast way to improve your visibility in search engines.

Keep following in the above tip and your will get a better result within days. Keep reading this website for more informative articles and unique SEO tips.

Display Google Page Rank INSTANTLY on Webpages

Add Page Rank Button or Icon to your web site - FREE!

  • By adding our Page Rank Checker Button to your site you can check the rank (check PR) of all your web site pages right on your web site.
  • To use our Page Rank Checking tool you just need to add a small piece of HTML code to the pages where you want to check the page rank and our free tool Page Rank Checker will show the small icon that displays the current Google.com PageRank of those web pages.

How to add Page Rank Checker to a web site

If you want Google Page Rank checking Button or Icon to be add to your web pages, please copy one of the HTML codes below and paste it on your page where you want the page rank icon to appear:

IMPORTANT: Please DO NOT modify the code, otherwise we can not guarantee the correctness of our free page rank checking tool that displays the page rank value and in case PR checking image DOES NOT work properly on your site?

Tuesday, February 12, 2008

Recent posts widget for your blog

With “Recent posts” widget you can show recently posted widgets or you can say all posts in one list which may help your visitor to browse around your blog or site. Here’s the procedure on how to in stall the widget on your blog : Just copy the above code and paste it in new widget of your blog. Also, don’t forget to add your sitename in the last line of HTML code where I’ve mentioned “http://yoursitename.blogspot.com”. I mean just replace it with your sitename and you are done. The above code refers to recent 10 postings from your blog.