...

View Full Version : Best way to make this fireworks nav into CSS?



zerox
02-15-2009, 11:49 AM
hi
im still new to css etc but have some basic skills.

Im waniting to make this image into a working navigation.
http://img443.imageshack.us/img443/1857/navimageuz3.jpg

Basically its just text with a font i downloaded and added a background as you can see.

What would be the best way guys?


many thanks

najkiie
02-15-2009, 04:01 PM
You could use Photoshop so slice it up to several items, and then just add the different menu images to your website and link them up.

-Nike

mike182uk
02-15-2009, 07:30 PM
you could use it as a sprite.

so say each button is 100px wide

have 5 buttons (home,cars,contact,search,about)

then for each button set its background image to the sprite image

and use the background position to position the text for each button.

i.e



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style>
#home {
background-image: YOUR IMAGE URL;
height: 40px;
width: 100px;
display: block;
background-repeat: no-repeat;
}
#cars{
background-image: YOUR IMAGE URL;
height: 40px;
width: 100px;
display: block;
background-repeat: no-repeat;
background-position: -100px;
}
</style>

</head>

<body>

<a id="home" href="#">Home</a>
<a id="cars" href="#">Home</a>
</body>
</html>


this saves you slicing it up, and saves you loading 5 images when you can just load 1.

Excavator
02-15-2009, 08:18 PM
Hello zerox,
With a little editing this code could be adapted to your image - http://nopeople.com/CSS/css%20rollover%20navbar%20with%20single%20image/index.html

That is a single image that makes all 6 buttons, the hovered buttons and the current page indicator.
View the source to see how it's done.

Avril
02-16-2009, 07:07 AM
Another way of doing it is to place all the links in a div bar which has the background image. To get the red stroke between the links the last link would have to be coded separately, so the ul solution is not practical. Try this:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 TRANSITIONAL//EN">
<html>

<head>
<title>navbar</title>
<style type="text/css">
#mynavbar {width: 610px; height: 25px; background-color: #3a3a3a; background-image:url(myimage.jpg); text-align:center; padding:3px;}
#mynavlink1,#mynavlink2, #mynavlink3, #mynavlink4 {float:left; clear:right; width: 120px; border-right: 1px solid #FF0000; color:#FF0000; line-height: 25px; font-size: 20px;}
#mynavlink5 {float: right; width: 120px; text-align:center; color:#FF0000; font-size: 20px; line-height: 25px;}
a:link {font-family: calibri; color:#FF0000; font-size: 20px; text-decoration: none;}

</style>
</head>
<body>
<div id="mynavbar">

<div id="mynavlink1"><a href="homepage.html">home</a></div>
<div id="mynavlink2"><a href="cars.htlm">cars</a></div>
<div id="mynavlink3"><a href="contact.html">contact</a></div>
<div id="mynavlink4"><a href="search.html">search</a></div>
<div id="mynavlink5"><a href="about.html">about</a></div>

</div>

</body>
</html>


Adjust size, font, etc. to suit your wishes and don't forget that the links, being text, will show only if the same font is available on the viewer's browser. Text is better for search-engines, but if you absolutely want to use the font in your example, you would have to convert it to an image map.

Also, I've done this on a Mac (Safari, FireFox) , and hope a PC will render it correctly

Cheers!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum