Webforumz's RSS FeedRSS Webforumz RegistrationRegister Contact Webforumz StaffContact

A way to change background color of a menu list

This is a discussion on "A way to change background color of a menu list" within the Web Page Design section. This forum, and the thread "A way to change background color of a menu list are both part of the Design Your Website category.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Design Your Website > Web Page Design

Notices




Closed Thread
 
LinkBack Thread Tools
  #1  
Old Oct 12th, 2004, 03:13
Junior Member
Join Date: Jul 2004
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
A way to change background color of a menu list

Hello and thanks for taking the time to even read this.
I am using my own multi-level menu, and I am having trouble getting the background color to show up behind "menu". when I hover over "background".

It seems to display the horizontal rule, <hr />, on top even after the menu opens. I've tried setting a width and z-index for the[*] element, but it doesn't work. Does somebody know how to get it to show up? I've made the html and body white for ease of seeing the problem because I want the background of the menu to show up black since my page background is black (I know it is a bad practice, but my friend loves dark colors).

XHTML-
Code: Select all
<ul id="menulist">[*]
    background >
    <ul id="menu">[*]background-color[*]background-image[*]background-repeat[*]background-attachment[*]background-position[/list]  [/list]<hr />
CSS-
Code: Select all
hr {
width: 600px;
}

ul {
list-style-type: none;
}

ul#menulist {
width: 91px;
height: 1px;
display: block;
}

li>a {
display: block;
padding-right: 2px;
}

ul#menu>li {
display: none;
}

ul:hover>li>ul#menu>li {
display: block;
margin-left: 50px;
margin-top: -21px;
padding-bottom: 15px;
padding-left: 5px;
}

html, body {
background: #fff;
}
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
  #2  
Old Oct 12th, 2004, 11:14
Rob's Avatar
Rob Rob is offline
Webforumz Founder

SuperMember
Join Date: Jul 2003
Location: Southern UK
Age: 34
Posts: 3,189
Blog Entries: 7
Thanks: 28
Thanked 22 Times in 19 Posts
Monie....

I would think long and hard before doing this because of the lack of browser support.

Use this code:
Code: Select all
<html>
<head>
<style>
hr {
	width: 600px; height:1px;
}

ul {
	list-style-type: none;
}

ul#menulist {
	width: 91px;
	height: 1px;
}

li>a {
	display: block;
	padding-right: 2px;
	white-space: nowrap;
}

ul#menu>li {
	display: none;
}

ul:hover>li>ul#menu>li {
	display: block;
	margin-left: 50px;
	margin-top: -21px;
	padding-bottom: 15px;
	padding-left: 5px;
	white-space: nowrap;
}

a:hover{color:#FF0000;}

html, body {
	background: #fff;
}
</style>
</head>
<body>
<ul id="menulist">[*]background ><ul id="menu">[*]background-color[*]background-image[*]background-repeat[*]background-attachment[*]background-position[/list]<hr />[/list]</body></html>
This should achieve what you want in Opera and Mozilla. You can even get the above to function for IE if you load the IE7 fixes.

It is important not to have any whitespace between li elements.. not even line breaks, so put all the ul and li code on one line.

Hope this helps.
__________________
Rob - Webforumz Founder

I am currently NOT available for SEO consultancy work

My Sites: Student Midwife Forum
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Closed Thread

Tags
change, background, color, menu, list

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Change Input Textbox Background Color tejaxx JavaScript Forum 4 Nov 19th, 2007 21:16
background color in xml kool77 Other Programming Languages 2 Jul 7th, 2007 16:30
background color kaz Web Page Design 4 Aug 4th, 2005 18:28
Anybody know how to change the color of a text input form in Physt Web Page Design 7 Aug 16th, 2004 09:44
change links color jenjen1018 Web Page Design 18 Jan 4th, 2004 21:52


All times are GMT. The time now is 19:08.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8