By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,310 Members | 1,466 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,310 IT Pros & Developers. It's quick & easy.

change bgColor

P: n/a
Hi,

I want to change the background color of a ul/li row, but the following
code is not working as I expected. It works in <table><tr>...

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>
<style type="text/css">
#css_table {font-family:Verdana, Arial, Helvetica, sans-serif;
font-size:11px; color:003366;}

#css_table ul {
padding: 0;
margin: 0;
list-style: none;
line-height:24px;
clear:both;
}

#css_table ul li {
padding:2px 8px 2px 8px;
width:auto;
border:1px solid #333333;
float:left;
}
</style>
<body>

<div id="css_table">
<ul onMouseOver="this.bgColor = '#C0C0C0'" onMouseOut ="this.bgColor =
'#FFFFFF'" bgcolor="#FFFFFF">
<li style="width:400px;">Jim</li>
<li>The</li>
<li>Fun</li>
<li>Begins</li>
<li><!-- Put Icon --> Here</li>
</ul>
<ul onMouseOver="this.bgColor = '#C0C0C0'" onMouseOut ="this.bgColor =
'#FFFFFF'" bgcolor="#FFFFFF">
<li style="width:400px;">Jim</li>
<li>The</li>
<li>Fun</li>
<li>Begins</li>
<li>Here</li>
</ul>
<ul onMouseOver="this.bgColor = '#C0C0C0'" onMouseOut ="this.bgColor =
'#FFFFFF'" bgcolor="#FFFFFF">
<li style="width:400px;">Jim</li>
<li>The</li>
<li>Fun</li>
<li>Begins</li>
<li>Here</li>
</ul>
</div>

</body>
</html>
Mar 10 '06 #1
Share this Question
Share on Google+
6 Replies


P: n/a
On Sat, 11 Mar 2006 01:13:25 +1100, acord <ac***@telpacific.com.au>
wrote:
the following
code is not working as I expected

</head>
<style type="text/css">


Hi acord. The <style> section belongs in the <head> section. Right now
you have it in the <body> section.

Ian
--
http://sundry.ws/
Mar 10 '06 #2

P: n/a
On Fri, 10 Mar 2006 14:28:36 GMT, Ian Rastall <id*******@gmail.com>
wrote:
The <style> section belongs in the <head> section. Right now
you have it in the <body> section.


Or, rather, it's inbetween the <body> and <head> sections, which is a
no-man's land. Nothing should be inbetween those two sections.

HTH HAND,

Ian
--
http://sundry.ws/
Mar 10 '06 #3

P: n/a
Ian Rastall wrote:
On Fri, 10 Mar 2006 14:28:36 GMT, Ian Rastall <id*******@gmail.com>
wrote:

The <style> section belongs in the <head> section. Right now
you have it in the <body> section.

Or, rather, it's inbetween the <body> and <head> sections, which is a
no-man's land. Nothing should be inbetween those two sections.

HTH HAND,

Ian

does it work at your end? it doesn't make may differnet here.

Thanks
A
Mar 10 '06 #4

P: n/a
On Sat, 11 Mar 2006 10:35:41 +1100, acord <ac***@telpacific.com.au>
wrote:
does it work at your end? it doesn't make may differnet here.


I apologize, I didn't check your code. Just trust me that the first
thing you have to do is put the <style> section in your <head>
section, though where is unimportant, as long as it's nested inside
<head>. After that, then work on the actual CSS.

Not to talk down to you, but to put it in basic terms, there is one
<html> section, with only two sections allowable inside it: <head> and
<body>. Everything goes inside one of those two. Nothing else is
allowed.

Ian
--
http://sundry.ws/
Mar 10 '06 #5

P: n/a
Ian Rastall wrote:
On Sat, 11 Mar 2006 10:35:41 +1100, acord <ac***@telpacific.com.au>
wrote:

does it work at your end? it doesn't make may differnet here.

I apologize, I didn't check your code. Just trust me that the first
thing you have to do is put the <style> section in your <head>
section, though where is unimportant, as long as it's nested inside
<head>. After that, then work on the actual CSS.

Thaks not the source of causing the problem.

Thanks
A Not to talk down to you, but to put it in basic terms, there is one
<html> section, with only two sections allowable inside it: <head> and
<body>. Everything goes inside one of those two. Nothing else is
allowed.

Ian

Mar 11 '06 #6

P: n/a
acord wrote:
this.bgColor = '#C0C0C0'


This is off-topic in this group. Try a stylesheet or Javascript group.

That having been said, try:

this.style.backgroundColor='#C0C0C0';

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact

Mar 11 '06 #7

This discussion thread is closed

Replies have been disabled for this discussion.