Advanced Search Usage Terms Submit Contact
Dynamic Drive CSS Library
 
CSS Library
Submit an original CSS code
CSS Layouts
Web Graphics
Online Tools:

Advertise Here

CSS Library: Horizontal CSS Menus: Here

Solid Block Menu

Author: Dynamic Drive

This is a lean, professional looking CSS menu that's draped in a solid two color background image. The divider between the menu items is simply a white CSS border. The style is extremely easy to customize thanks to the simple background image used.

Demo:


The two images used (resized horizontally):

The CSS:

The HTML:

Code Info

Rate this code:

Date Posted: 03/27/2007

Revision History: July 6th 08"- Updated CSS for improved clear float in IE.

Usage Terms: Click here

Your Comments (165)

Got a question or need help customizing this CSS code? Post it in the CSS Forums. If you have a comment or suggestion instead, post it in the comments section below.

Comment Pages 4 of 17 pages « First  <  2 3 4 5 6 >  Last »

I want to reposition the nav bar. since my site already has a logo on the top of the page. i want to be able to position it under the logo i made.
Posted by tim on 04/21, 09:04 PM
The easiest way to center this 'bar', although not necessarily the best way, is to measure out the excess 'bar' at the end of the links on the right, measure it, divide it in half, and then create an image with those dimensions (for me, there was 272px of excess space on the right side originally, so I created an image that was 136px X 36px).

Create a table with two cells, in the left cell, place your image with specific measurements (relative to your bar length, so 136x36), and then paste the html code in the right cell for the actual bar. If you align it properly and get the image tweaked, it will look exactly as if the 'bar' is centered (and therefore falsely stretched to cover the left side).

Not the easiest way of doing it in the world, but it's working fine for me. Here's the code if you're having a hard time understanding what I mean, but hopefully with this you can understand the concept.


<table border="0" width="767" id="table1" cellspacing="0" cellpadding="0">
<tr>
<td width="136">
/000/test/images/structural/nav-filler-left.gif</td>
<td width="631">
<ul class="solidblockmenu">
<li>Home</li>
<li>Biography</li>
<li>Discography</li>
<li>Media</li>
<li>Events</li>
<li>Contact</li>
</ul>
</td>
</tr>
</table>
Posted by G-Snake on 04/25, 02:36 PM
ok not sure why this works but it does, heres the external css (im using IE6):

<style type="text/css">

/*Credits: Dynamic Drive CSS Library */
/*URL: http://www.dynamicdrive.com/style/ */

.solidblockmenu li{
display: inline;
}

.solidblockmenu{
margin: 0;
padding: 0;
float: left;
font: bold 13px Arial;
width: 100%;
border: 1px solid #625e00;
border-width: 1px 0;
background: black url(blackblock.gif) center center repeat-x;
list-stlye:none;
}

.solidblockmenu li{
display: inline;
}

.solidblockmenu li a{
float: left;
color: white;
padding: 9px 11px;
text-decoration: none;
border-right: 1px solid white;
}

.solidblockmenu li a:visited{
color: white;
}

.solidblockmenu li a:hover, .solidblockmenu li .current{
color: white;
background: transparent url(redblock.gif) center center repeat-x;
}

</style>
Posted by adam on 04/30, 10:17 AM
I can't get the menu to NOT wrap when I resize the browser window. Any ideas why? Thanks
Posted by acosta on 04/30, 01:07 PM
its not working.
Somebody please help me.
I tried putting all those codes in dreamweaver... but all I see black menu bar, when I click on the buttons it should roll over the red image.
But its not.
Help me out :(
Posted by Desi MC on 05/01, 03:48 AM
what i did was change this part of the CSS

background: black url(media/blockdefault.gif) center center repeat-x;

into this

background: black url("blockdefault.gif") center center repeat-x;

and you should have the pictures of the red and black blocks stored in the same file as where you are placing your html file
Posted by tim on 05/01, 08:05 PM
It looks great but for some reason I cannot get the black background image to display. Any thoughts?
Posted by Al Ross on 05/11, 05:33 PM
I think I have to do something with this... but not sure what...

var ddtabmenu={
disabletablinks: false, ////Disable hyperlinks in 1st level tabs with sub contents (true or false)?
currentpageurl: window.location.href.replace("http://"+window.location.hostname, "").replace(/^\//, ""), //get current page url (minus hostname, ie: http://www.dynamicdrive.com/)
Posted by Al on 05/12, 11:40 AM
This is a nice menu. I got it working with a embedded stylesheet but it doesn't work with an external stylesheet. I tried is with Firefox 2 and IE 6
Posted by Fred on 05/13, 09:34 AM
Now I also got the external css working. I work with relative paths and forgot two dots in line background: black url(../art/blockdefault.gif) center center repeat-x;

Great work and thank you
Posted by Fred on 05/13, 10:14 AM

Comment Pages 4 of 17 pages « First  <  2 3 4 5 6 >  Last »

Commenting is not available in this weblog entry.
Copyright 2006-2011 Dynamic Drive Read our Usage Terms before using any of the CSS codes.