Archive for August 2008

 
 

Styling Forms with CSS

When you don’t quite get it, styling forms with CSS can be a real pain. But once you get your head around it you will see that there’s nothing really too difficult about it.

In this tutorial you will see how to create this contact form and style it so that it looks like this. In the future I am going to make some further guides on how to take the information entered and send it to yourself using PHP or ASP, but that’s for another day.

Right, so first of all we’re going to need our form. I am going to use this one. Your free to use this code if you don’t have a form of your own. Here’s the code for the form:

<form action=”” method=”post”>
        <label for="user_name">Your Name</label>
        <input type="text" name="user_name" class="inputbox"/>
        <label for="user_email">Your Email</label>
        <input type="text" name="user_email" class="inputbox"/>
        <label for="user_message">Your Message</label>
        <textarea name="user_message"></textarea>
        <input type="submit" value="submit" name="submit" class="submit"/>
</form>
 

Now as you can see the form is very simple and doesn’t look very good at all just yet. We’re going to fix that though.

First of all, we’re going to give the form a css class so that we can style it and all the elements within it. To do this we simply change:

<form action=”” method=”post”>
 

To:

<form action=”” method=”post" class="webform">
 

You will notice I added a class to our form rather than an id. This is simply because you might want to use more than one form on your page and using a class will keep the page valid whether you have one form or ten.

Simple, eh? Now lets start styling.

In our CSS document, we’re going to add a style for our form. So we add:

.webform{}
 

All of our styling will go between the { and the }. Now, I dont want my form to be too wide so I’ll add a width to my CSS.

.webform{
        width:400px;}
 

Next, we’ll add a font, a font colour and a background colour.

.webform{
        width:400px;
        font:11px Arial, Helvetica, sans-serif;
        color:#777;
        background-color:#fff;}
 

Now that the basic styling for our form is done, we can add some styling to the labels and inputs. First of all we will tackle the labels with the following CSS.

.webform label{
        display:block;
        width:300px;
        font-weight:bold;}
 

All the CSS above is pretty simple, we used the “display:block;” so that all the labels will start on a new line. This means we dont have to add any breaks (
tags) after every line. After we added the styling to our labels you can see that the form is starting to look a lot better. Now for the inputs.

.webform .inputbox{
        height:18px;
        width:250px;
        padding:4px 3px 2px 3px;
        margin:2px 0 10px 3px;
        border:1px solid #ccc;}
 

Again, I haven’t used anything to difficult to style the input boxes but they look a lot better! You might have noticed the submit button is a bit screwed up, dont worry, we’ll be fixing that later. But first we will make the textarea look better with the following CSS.

.webform textarea{
        height:80px;
        width:250px;
        padding:4px 3px 2px 3px;
        margin:2px 0 10px 3px;
        border:1px solid #ccc;}
 

So now the form is looking fine and dandy, apart from that pesky submit button. Lets add a class to it.

Change:

<input type="submit" value="submit" name="submit"/>
 

To:

<input type="submit" value="submit" name="submit" class="submit"/>
 

Now our submit button has a class of submit. Now for the CSS.

.submit{       
        margin:2px 0 0 3px;
        background-color:#eee;
        height:30px;
        width:80px;
        padding:0;
        border:1px solid #ccc;
        display:block;
        color:#666;}
 

Again, we have used the “display:block;” style to put the button on a new line without using a break. I have also added a background colour, padding, a border and margin. All of these are pretty simple CSS styles. If you need help with the different CSS styles check out the beginners guide to CSS tutorial.

As you can see, our form is looking very nice now and it has all been done with some simple CSS and minimal extra HTML. You can see the finished CSS form here.

Top WordPress plugins

Although wordpress is a fantastic blogging platform, the thing that makes it really amazing is the amount of extras or plugins that are available for it. You can make wordpress do pretty much anything you want using these plugins. This post contains a list of my

favourite wordpress plugins. If you think I’ve missed something that should be on this list, leave a comment or get it touch with me using the contact page.

Backup Wordpress

I put this one first because it seriously is the most inportant plugin of all if you’re going to put any sort of effort into your blog.

You could lose the content of your blog at any time, for a million different reasons. Anything from hacking to a host problem, or even simple human error can see you lose your months or years of hard work in seconds. Backup Wordpress is a handy (and free)

plugin that will automatically backup your database or your whole site at regular intervals. You can also do a manual backup anytime you fancy. It will even email you the backups!

Setting Backup Wordpress up is as simple as all wordpress plugins and requires minimal configuration. So dont risk losing your data, back it up!

BackUp WordPress

Comment Luv

I’ve mentioned this plugin on my blog before, but it’s worth mentioning again. Comment Luv encourages users to post on your blog by showing a link to their latest bog post underneath their comment. This plugin is great for increasing user interactivity with your site.

CommentLuv

Comment Rellish

This plugin is good for getting users that have commented on your blog to come back. The first time someone posts a comment on your forum, it sends them an email saying whatever you want. I reccommed saying thanks for their comment and asking them to

check back to the site every now and again.

The best thing about this plugin is that it will only send them an email the first time they comment, so they wont get angry about being bombarded with emails if they post on your blog a few times!

Comment Relish

Askimet

This plugin comes bundled with wordpress as default, make sure you have it activated! It checks every trackback, comment and pingback on your blog to make sure its all legit and there’s no spam. If you have a popular blog it can save you hours and hours of trawling through spam.

Askimet

All in one SEO

The All in one SEO plugn does exactly what it says. It provides pretty much everything you need to optimise your blog for search engines, and it’s even better when you combine it with other SEO plugins such as the sitemap generator below.

Some of its features include:

  • Automatically optimizes your titles for search engines
  • Generates META tags automatically
  • Avoids the typical duplicate content found on Wordpress blogs
  • For Wordpress 2.3 you don’t even have to look at the options, it works out-of-the-box. Just install.
  • You can override any title and set any META description and any META keywords you want.
  • You can fine-tune everything
  • Backward-Compatibility with many other plugins, like Auto Meta, Ultimate Tag Warrior and others

All in one SEO

Google XML Sitemaps Generator

This plugin will automatically generate an XML sitemap of your website. Google, MSN and Yahoo search engines all love XML sitemaps which means they can easily find and list every one of your pages in their search engines. The sitemap generator will even rebuild your sitemap when you create a new post and it will ping Google, MSN and Yahoo to tell them that the sitemap has been altered so they should re-spider it!

Google XML Sitemap Generator

Latest Update

So the new layout is about 90% complete. There are still a few plugins to re-install and a few little changes to make before I’ll be totally happy, but I’m nearly there!

Before anyone asks, the images above the posts are just random. They are mostly images that I’ve seen on IStockPhoto that I’ve liked.

The new tutorials will be coming, Monday at the latest.

Oh, and I’d be most grateful if you would sign up for my RSS Feed!

New layout up….sort of

As I’m sure you can see, the new layout is half online at the moment. There are still some bits and peices to change and I need to tidy up the old posts. Hopefully it will all be done tonight, tomorrow at the latest.

Network Makeover

You might have noticed I haven’t posted here for a while. This is mainly because I’ve been working on some new websites which will all come under a new network of sites that I’m working on. Initially the network (when it’s launched) will have two sites with another being launched a month or two after.

The new site is a massive project and is in beta testing as I write this. More information will be posted here when I want to make the site public.

This website hasn’t been forgotten though! I have been working on some more articles that I will be launchung weekly to get the site the popularity it used to have. I’ll also be adding a shiny new layout to the site pretty soon so stay tuned!