Archive for Design

Funky sliding door tabbed menus

// August 2nd, 2008 // 4 Comments » // Design, Free Stuff, css, downloads, tutorials

A Funky menu

Tabbed sliding doors menus look funky and elegant as well as being scalable. You can add as much text as you want and the tabs just expand and don’t break apart, they also re-size nicely when you bump up the text in your browser.
So today I’m going to show you how to create my own little twist on the very popular Sliding Doors of CSS menus by Douglas Bowman

As you can see in the image (above) I have an overlapped current state or ‘on’ tab which is very simple to produce using some minimal HTML and CSS. First, lets get our hands dirty with some mark up.

The mark up

All we need is a simple unordered list like below:

<div id="mainNav">
<ul>
<li id="current"><a href="home.html">Home</a></li>
<li><a href="blog.html">Blog</a></li>
<li><a href="portfolio.html">Portfolio</a></li>
<li><a href="about.html">About</a></li>
<li><a href="contact.html">Contact</a></li>
</ul>
</div>

Notice the first list item has an id of “current”

<li id="current"><a href="home.html">Home</a></li>

This is our ‘hook’ to set the ‘on’ state in our menu. In this case it is set for our home page. On subsequent pages, the “current” hook will be set on the other pages like the example below for our second page which will be our ‘Blog’ page.

<li><a href="home.html">Home</a></li>
<li id="current"><a href="blog.html">Blog</a></li>
<li><a href="portfolio.html">Portfolio</a></li>
<li><a href="about.html">About</a></li>
<li><a href="contact.html">Contact</a></li>

And that’s all folks (the mark up that is). I told you it was simple!

Lets get funky!

Now we need some images for our menu, so open up the image tool of your choice (I used Adobe Fireworks for this tutorials example) and set a canvas size of 20 pixels wide and 45 pixels in height. Set the canvas color to transparent. This will be our background for our menu.

Fig 1
creating the menu background fig 1

Now draw a rectangle on the top half of the canvas with a height of 32 pixels and a height of 20 pixels and set the colour fill to white.

Fig 2
creating the menu background fig 2

With our rectangle still selected, select the gradient tool and choose the colours #B02E3E (red) and #FFFFFF (white) like in the example below.

Fig 3
creating the menu background fig 3

Now draw the gradient from top to bottom so you get a gradient like the image below

Fig 4
creating the menu background fig 4

Our final step will be to add a solid colour to the bottom, so again grab the rectangle tool and draw a rectangle shape on the bottom of the canvas with a width of 20px and a height of 14px. Set the colour fill to #B02E3E and you should now have a completed image like below. Save this as bg.png

Fig 5
creating the menu background fig 5

Let’s make some funky tabs!

Here comes the tricky part – creating the rounded corner tabs – ok I’m kidding – it’s not that hard! So heres how:

Create the ‘on’ tab right hand ‘door’

Open a new document and make a canvas of 400 pixels wide and 150 pixels in height. Set the background colour to transparent.
Now grab our friend the rectangle tool and draw a slightly over-sized rectangle on the canvas about 417 pixels wide and 172 pixels in height and set the stroke colour to #999999 at 1 px. Position the top right corner of the rectangle to line up just against the top right of the canvas so you can just see the stroke outline (see below)

Fig 6
creating the right on state tab fig 6

Set the rectangle roundness to 8 so you get a curved corner at the top right.

Fig 7
creating the right on state tab fig 7

Lastly, lets add some effects to make the tab stand out. With the rectangle still selected, go to the properties menu and click on the filters button. Select inner shadow from the drop down menu and input the settings in the pic below:

Fig 8
creating the right on state tab fig 8

Finally crop the image to size and you should have the right hand door completed like this:

Fig 9
creating the right on state tab fig 9

Save the image as onRight.png

The left ‘door

Open a new document and make a transparent canvas of 9 pixels wide and 150 pixels in height. Again we draw another over sized rectangle with the rectangle tool (about 400 pixels wide and 157 pixels in height) and set the colour fill to #FFFFFF with a 1px stroke set to #777777.

Fig 10
creating the left on state tab fig 10

Like with our right hand door, set the rectangle roundness to 8 and click on the filter menu in the properties panel, select inner glow and enter the settings below.

Fig 11
creating the left on state tab fig 11

Crop it to size and you have completed the second part of our first sliding door tab. When we get stuck into the CSS we will be putting these two guys together. Save the image as onLeft.png

Fig 12
creating the left on state tab fig 12

Making the ‘off’ door tabs

Quite simply, follow the same steps as figures 6-12 only this time we are going to change the filter effects with a different inner glow colour and settings. Use the following settings for both images set the glow colour to #B02E3E and save the left side tab as “leftOff.png” and the right sided one as “rightOn.png”

Fig 13
creating the right off state tab fig 13

Heres what your completed images should look like for your “off” state tabs

Fig 14
creating the right off state tab fig 14

Fig 15
creating the right off state tab fig 15

Now we have all our images, lets get to work and style these bad boys!

Styling it up!

Lets start by setting up some defaults to the body. Notice I have set the font size to 62.5%. This knocks the base font size down to 10px which we can notch up in EM’s later within our menu.


body {
margin:0 auto;
padding:0;
width:550px;
font-size:62.5%;
background: #fff;
font-family:Tahoma, Arial, Helvetica, sans-serif, Verdana;
}

Now we are going to position our menu by floating it left and setting the width to 100% so that it fills the width we set in the body. We have also used our first image – the background (bg.png) which we set to tile on the x-axis across the width of our menu. This will be our cool funky background gradient image.


#mainNav {
margin-top:100px;
float:left;
width:100%;
background: url(img/bg.png) repeat-x bottom;
font-size:93%;
line-height:normal;}

Here lets nullify any margins to our unordered list and set a list style to “none” to get rd of those nasty bullet points and set some padding.

#mainNav ul {
margin:0;
padding:10px 25px 0;
list-style:none;}

Next step is to float the list elements in our menu left and insert the first of our tabbed images – our off left side “door”. We set this to be positioned top left and not to repeat.

#mainNav li {
float:left;
background: url(img/offLeft.png) no-repeat left top;
margin:0;
padding:0px 0 0 9px;}

A menu is not a menu unless we can click it, so lets add some CSS to our anchors. Again we float left and display our anchors as Block so that they are clickable. We add our second image (offRight.png) which is the right sided “door” and add some padding around our anchors or linked text which gives some breathing space inside the tabs when they are joined together. Notice the positioning of the image? We set it not to repeat, but this time we position it at the top right. As this is the “off” state we set the text decoration to none to get rid of the default underlining of text.


#mainNav a {
float:left;
display:block;
background:url(img/offRight.png) no-repeat right top;
padding:5px 15px 4px 6px;
text-decoration:none;
font-weight:bold;
color:#765;}

The last thing we need to do with the tabs is add a ‘hover’ to them. Here I have chosen a colour and an underline state when the cursor hovers over the tabs.


#mainNav a:hover {color:#b02e3e;text-decoration:underline;}

Setting the Current state

To show your site visitors what page they are currently on we set the images up for the “current” state by using the first set of “doors” we created earlier. I have given a height of 25 pixels so that the tab overlaps the bottom of our background image and stands out.


#mainNav #current {
background-image:url(img/onLeft.png);
color:#b02e3e;}

And finally……..


#mainNav #current a {
background-image: url(img/onRight.png);
color:#b02e3e;
padding-bottom:5px;
height:25px;}

And thats it folks! All there is to it – 5 images, an unordered list and 8 blocks of CSS to create a cool stylish menu. If you are stuck and are having trouble creating the images, you can download the source files including the HTML and the CSS for you to experiment with or even use on your website.
The menu is cool with all standards compliant browsers (Firefox/Safari/IE7/Opera etc..) and also works as far back as IE5.5 and IE6! Only watch out when using transparent PNG’s as I have done as IE 6 and below will not display the images with alpha transparency backgrounds so either serve up an alternative version using conditional comments or keep it the same using gifs. The choice is yours!
Have Fun! :-)

Download

Download the source files


Creative Commons License


This work is licensed under a
Creative Commons Attribution-Share Alike 2.0 UK: England & Wales License.

Splashes Of Colour

// February 26th, 2008 // 8 Comments » // Creativity, Design

My day to day reading of blogs always throws up a few suprises and they sometimes lead me on a kind of ‘wild web chase’ finding sites I have not seen before. Lately I have come across some real gems in terms of design, colour, typography and the downright crazy!

Camping Il Frutteto

In our first example (a downright crazy one) we see this huge in your face, sunny, landscape background with a bright red apple in the centre of it all. The apple contains the menu and by clicking on a menu item, the page whizzes right. Click the home link from a page, and it whizzes back left. At first you will think “oh that’s flash built”, but it is actually Javascript which makes the pages whizz around like that.
The big downside is that with Javascript turned off, clicking the menu items takes you no-where! I just wonder if the client asked for this bonkers functionality or if the design agency came up with idea. Whoever it was didn’t give a hoot about unobtrusive JS or progressive enhancement.
Still I love the colours used in this design, you can’t go far wrong with some lovely rich blues, greens and browns.

Lee Munroe

This is a stunning design from Lee Munroe a freelance web developer from Belfast, Northern Ireland. I love the way the theme changes to reflect the time of day, kind of like the themed google home page but a lot lot nicer. Lee has used some beautiful colours to create some stunning vectors for the backgrounds to give a ‘happy’ kind of feel as you navigate the site. Also, look out for the tiny insect running riot in the footer! – A nice touch!

Jamie Knight

Now when Jamie Knight speaks you listen! A fantastic website chockablock with microformat goodness. Jamie has given a lot of thought to detail when he created jkg3.com and the design reflects Jamie’s personality. I can’t mention Jamie without mentioning Lionwho never leaves his side. You can see a cute reference to Jamie’s best pal in the background graphic which is seamless and gorgeous!

Veerle Pieters

This is one of my favourite sites to visit on a day to day basis. I normally shy away from dark background colours, but Veerle Pieters does this fantastically well. The background allows the content to become more in focus. She uses a four column grid type layout with the side content giving the impression of it just hiding or overlapping under the main content section to give a shadowy effect. The vector art she has used in her brand logo is simply stunning.

Create A Favicon

// February 14th, 2008 // 1 Comment » // Code, Design, tutorials

As you are reading this post, look up into your location bar at the top of the screen, notice the little icon to the left of the web url? This is a favicon and in this article, I am going to show you how to add this to your WordPress site.

What Is A Favicon?

Favicon is short for “Favourites-Icon” and is sometimes referred to as a “Web icon” or “Page icon”. Favicons are a great way of adding a little personality or identity for your website. They are very handy when looking for a favourite site amongst your bookmarks. By locating the little icon in your bookmarks list, you can locate quickly and easily your chosen web site just by recognizing the little favicon.

Choose an Image

First choose an image that you think that represents your site. Be it an icon, logo or even a letter, you choose! You can do this in any image software you have (Photoshop/Fireworks/Illustrator etc..).

Create…

Now to make things easier for you, visit either GenFavicon or Chami.com where you can upload an image from your mac/PC and resize the icon on any one of these sites. Once done you can download your newly created favicon.

Next step – place the favicon.ico file into the Root of your website folder (In WordPress, this is the initial folder not your themes folder) and upload to your server – usually to public.html. This is important that you do place the file in the root directory as browsers will recognize the .ico file without searching for a HTML document.

Add Some Simple Code….

Now open header.php and add the following lines of code inside the <head> of the header.php file:

<link href="/favicon.ico" rel="icon"/>
<link href="/favicon.ico" rel="shortcut icon"/>
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />

Save – Upload – Enjoy!

Save the file and upload to your server. Now visit your site and refresh the page, you should now see your newly created favicon in the address location bar at the top of your screen.