Web design help please.

Messages
13,582
Name
Dean
Edit My Images
No
I'm building my first website for my photography atm. The problem I have is the font I want to use for my nav bar isn't standard so I'm going to have to create images. No problem with that, but I also want to create inverted images for when the cursor hovers, and I've no idea how to go about coding that.

Do I do this like a normal nav bar with the images floated in an ul? How do I set the a:hover up with that with images?
 
Wherever possible, avoid the javascript solution.

If you are going to create an image with a different hover state, create the image in photoshop (or similar), duplicate it and move it directly below and make the colour changes etc.., crop and save as a single image. Then use it as the background image for your li and use css to position it top, then bottom for hover. ;)

Doing it this way with one image avoids the need for messy preloads and also means the hover image is already loaded and ready to go immediately.
 
Thank you both for your replies. I would rather use a css solution if possible.

flicker, that tutorial looks perfect, thank you. :)
 
You can do it a couple of ways, the easiest is to use CSS to change the background image and use a standard font (like Arial).

It would look something like this:
a.link:hover
{
background-image: url(images/background.png);
color: #FFFFFF;
}

a.link:active:visited
{
background-image: url(images/normal_background.png);
color: #000000;
}
That can go in a file called style.css, you will then need to put in your site between the <head> tags this:
<link rel="stylesheet" type="text/css" href="style.css" />

You will then need some HTML like this:
<a href="Page.html" class="link">Page 1</a>

Alternatively, there are free templates available or you might be able to find a designer to do it cheaply.
 
I want to do it myself. I'm learning coding atm and need to know these things. :) A different font isn't an option I'm willing to try as it will ruin the site. It's very minimalistic as it is so the style needs to be bang on.
 
Easiest way with css is to have just one image. Let's say it's 180px high and 60px high. Top half is your normal state, bottom half is the 'over' state.

Just use css like this:

#div_name a{
background: url(image.jpg);
display: block;
}

and when you hover:

#div_name a:hover {
background-position: 0px -30px;
}

That's what I always do. Here's a quick example: www.fidani.co.uk

Here's the image in use:

www.fidani.co.uk/templates/fidani_template/images/menu_bg.gif

Hope that helps
 
In fact, here's the relevant CSS:

#sidebar_left ul{
list-style-type: none;
}

#sidebar_left li{
line-height: 30px;
}

#sidebar_left a {
display: block;
font-weight: bold;
color: #EBB716;
padding-left: 20px;
text-decoration: none;
background: url(../images/menu_bg.gif);
}

#sidebar_left a:hover {
background-position: 0px -30px;
}
 
Thank you, but I'm even more confused now! I don't think I can do it the way you suggest because the whole issue is in using an unusual font which will require me to have separate images for each button. A picture speaks a thousand words so this screen shot of my homepage (image just for sizing really as a gallery will probably be going there) shows what I'm attempting to create. I just cannot get my frazzled brain around how to position these.

screen.jpg
 
You can run custom fonts using php to load them. b****r knows how to get it working as my server doesn't support php to try (damn MobileMe). A wee Google search might be useful.
 
Okay, I think I understand how best to do this now. I'm going to create one long image made up of all the buttons I need and then apply the code to that. Hopefully that'll work!

Thanks guys. :)
 
Just a quick question,Why does nobody recommend Javascript?

I tested it after posting on here earlier and it's very quick and easy to figure out..

Javascript isn't always on - I have it switched off by default so if it can be done without it, it should be. It also takes more loading. Javascript should be the very last thing you start adding to a site and the site should work the way you want it to without javascript enabled. Some people have used javascript for drop down navigation menus which basically removes any chance of a non javascript user knowing them pages even exist.

I could go on and on but that's the main reasons anyway.
 
Javascript isn't always on - I have it switched off by default so if it can be done without it, it should be. It also takes more loading. Javascript should be the very last thing you start adding to a site and the site should work the way you want it to without javascript enabled. Some people have used javascript for drop down navigation menus which basically removes any chance of a non javascript user knowing them pages even exist.

I could go on and on but that's the main reasons anyway.

Interesting analogy. Many millions of top sites are javascript dependent. So how would you implement a complex design structure? Pure html? Pure CSS? PhP? Ruby?
 
If you come across a site that is JavaScript dependent, it's a bad one. You'll probably find the sites you think are JavaScript dependent aren't. They will work perfectly with it disabled but JavaScript just adds some frills
 
So how would you implement a complex design structure? Pure html? Pure CSS? PhP? Ruby?

Not too sure what you mean by "implement a complex design structure". Pure css? css is nothing without html. I use html as the markup language it is supposed to be, I use css to style the html as it was created for. I use php, which is a serverside programming language to do the serverside stuff - I don't use ruby as I choose to stick with php. Javascript is a client side progamming language.

More examples of bad sites that use javascript incorrectly are ones which rely on it for validation e.g. "you can't submit this form until you have entered your name" - turn off javascript and your form will be submitted without a warning. It should be validated via php (or the server side language used) first, then add the javascript validation for frills.
 
Back
Top