LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 02-25-2004, 10:05 AM   #1
patpawlowski
Member
 
Registered: Mar 2003
Location: Centreville, Virginia
Distribution: Mandrak, Red Hat
Posts: 163

Rep: Reputation: 30
Setting Background color using CSS


I have been trying to set the background color for a table using the style sheet. I have tried background:black, background-color:black and bgcolor:black. Both background and background-color only change the text background color not the entire cell and bgcolor does nothing. Right now as you mouse over the menu options the text links change color. I thought that If I put the menu in a table with no borders I could get the same effect with the cell background.

Any ideas. I could write some JS to do it but I thought it would be easy using the style sheet.
 
Old 02-25-2004, 10:12 AM   #2
jtshaw
Senior Member
 
Registered: Nov 2000
Location: Seattle, WA USA
Distribution: Ubuntu @ Home, RHEL @ Work
Posts: 3,892
Blog Entries: 1

Rep: Reputation: 67
Which table element did you set background on? You can look at my stylesheet if you would like to see how I setup the table stuff.
 
Old 02-25-2004, 10:59 AM   #3
patpawlowski
Member
 
Registered: Mar 2003
Location: Centreville, Virginia
Distribution: Mandrak, Red Hat
Posts: 163

Original Poster
Rep: Reputation: 30
I figured out how to set the background color now I am looking for a mouseover or hover event similar to the one you used with links. Essentially I am trying to get the background color to change onmouseover. I know I can do it with javascrip but I thought it might be easy with the style sheet similar to the way you can do it with links.
 
Old 02-25-2004, 01:27 PM   #4
wapcaplet
LQ Guru
 
Registered: Feb 2003
Location: Colorado Springs, CO
Distribution: Gentoo
Posts: 2,018

Rep: Reputation: 48
I don't know whether CSS directly supports this; the CSS2 specification doesn't define which elements the ":hover" pseudoclass can apply to, so if you wanted to use that for table elements (like td), it may be supported in some browsers, but no guarantees. Javascript is probably the best way to do it, and is more likely to work in major browsers.

One place I saw this recently was the PHPFreaks tutorial site (using javascript to switch between CSS definitions); check out their code to see how it was done. Pretty simple, really.
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
VI Background Text Color mahugl Linux - Newbie 3 12-15-2013 10:12 PM
Change background color chingyenccy Linux - Newbie 6 01-23-2005 03:17 AM
TTY background color! hitesh_linux Linux - General 1 09-17-2004 06:22 AM
get-background-color in GTK+-2.0 fromzj Programming 0 04-04-2004 03:46 AM
ncurses background color gtanghookup Programming 1 09-02-2003 08:17 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:48 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration