| | |
Add a background color to a table
Please support our HTML and CSS advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
hi guys, i have this code..to display a table.. but how to add a background color to a table? any help is greatly appreciated.. thanks...
HTML and CSS Syntax (Toggle Plain Text)
<table cellpadding="15" cellspacing="15"> <tr> <td>CELL 1</td> <td>CELL 2</td> </tr> <tr> <td>CELL 3</td> <td>CELL 4</td> </tr> </table>
TRY MY SUGGESTIONS AT YOUR OWN RISK
Do other alternative first..cheap and easy ways..
Don't take out money from your pocket when you're not so sure that it will solve the problem..
Do other alternative first..cheap and easy ways..
Don't take out money from your pocket when you're not so sure that it will solve the problem..
•
•
Join Date: Aug 2008
Posts: 5
Reputation:
Solved Threads: 1
edit your table to something like
OR with(RGB)
<table cellpadding="15" cellspacing="15" bgcolor="red"> OR with(RGB)
<table cellpadding="15" cellspacing="15" bgcolor="#FF0000"> Last edited by peter_budo; May 14th, 2009 at 6:38 am. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
That is ancient code. Add a style to the stylesheet instead:
HTML and CSS Syntax (Toggle Plain Text)
table {background-color: #ff0000;}
Daylight-saving time uses more gasoline
HTML and CSS Syntax (Toggle Plain Text)
table {background-color: #ff0000;}
hi MidiMagic, how to call that code to the table..
i used like this but it doesn't work, how to do it? thanks...:
HTML and CSS Syntax (Toggle Plain Text)
<style type="text/css"> #table1 {background-color: #ff0000;} </style> <table class="table1" cellpadding="15" cellspacing="15">
Last edited by cguan_77; May 11th, 2009 at 2:21 am.
•
•
Join Date: Jan 2008
Posts: 79
Reputation:
Solved Threads: 9
if you use
you don't need to add class or id to your table, it will change all table background to #ff0000
HTML and CSS Syntax (Toggle Plain Text)
table {background-color: #ff0000;}
•
•
Join Date: May 2009
Posts: 10
Reputation:
Solved Threads: 2
yes please use a stylesheet that was if you need to use it again you can just declare the class again and dont use "red" or "white" use the proper hash code like "#fffffff"
Printed Lanyards at Lanyardpass.co.uk
•
•
•
•
if you use
you don't need to add class or id to your table, it will change all table background to #ff0000HTML and CSS Syntax (Toggle Plain Text)
table {background-color: #ff0000;}
•
•
Join Date: Jan 2008
Posts: 79
Reputation:
Solved Threads: 9
Mmmm thats strange,
Here's my example and its work
HTML and CSS Syntax (Toggle Plain Text)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.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> table { background: #000000; } </style> </head> <body> <table width="400" border="0" cellspacing="0" cellpadding="0"> <tr> <td> </td> </tr> </table> </body> </html>
Thanks for all the help guys...
Thanks rudevils
i think the reason why it's not working
i miss this thing on the header..
Thanks rudevils

i think the reason why it's not working
i miss this thing on the header..
HTML and CSS Syntax (Toggle Plain Text)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml">
![]() |
Similar Threads
- need help changing background color of an iframe (JavaScript / DHTML / AJAX)
- JTabbedPane background color (Java)
- iframe background color - pls help (HTML and CSS)
- Not able to set the background color of JComponent (Java)
- how to print table background color? (HTML and CSS)
- HTML 3.2 table background color (HTML and CSS)
- VS 2005 ListViews not holding background color (C#)
- help with setting background color!!! (Java)
Other Threads in the HTML and CSS Forum
- Previous Thread: Image Preloading not working in IE6!! Only CSS..
- Next Thread: Website is zoomed out so big on IE browser
| Thread Tools | Search this Thread |
appointments asp background backgroundcolor beta browser bug calendar cart cgi code codeinjection corporateidentity css design development displayimageinsteadofflash dreamweaver emailmarketing epilepsy explorer firefox flash form format google griefers hackers hitcounter hover html ide ie7 ie8 iframe image images internet internetexplorer intranet iphone javascript jpeg layout macbook maps marketshare microsoft mozilla multimedia navigationbars news offshoreoutsourcingcompany opacity opera optimization pnginie6 positioning problem scroll seo shopping studio swf swf. textcolor timecolor titletags url urlseparatedwords visual visualization web webdevelopment webform website windows7






