p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


Go Back   p2p.wrox.com Forums > Web Programming > CSS > CSS Cascading Style Sheets
I forgot my password Register Now
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
CSS Cascading Style Sheets All issues relating to Cascading Style Sheets (CSS).

Welcome to the p2p.wrox.com Forums.

You are currently viewing the CSS Cascading Style Sheets section of the Wrox p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.

Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 23rd, 2006, 04:56 PM
Authorized User
Points: 255, Level: 5
Points: 255, Level: 5 Points: 255, Level: 5 Points: 255, Level: 5
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2004
Location: , , .
Posts: 55
Thanks: 0
Thanked 0 Times in 0 Posts
Default Change border color for every cell of a table

Hi all,

I want to change the border color of every cells or rows of a table but I am not quite sure what is the best way to do it. Personally, I want to change on the table level, not on cells or rows object.

Setting border=1 on table tag will turn all border on but when we try to change border color then only 4 sides border are changed and inside are not. Does anybody know how to do this?

JDang

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #2 (permalink)  
Old February 23rd, 2006, 05:01 PM
richard.york's Avatar
Wrox Author
Points: 5,386, Level: 31
Points: 5,386, Level: 31 Points: 5,386, Level: 31 Points: 5,386, Level: 31
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Camby, IN, USA.
Posts: 1,697
Thanks: 0
Thanked 1 Time in 1 Post
Default

Take the HTML border attribute away, and apply the following CSS between <head> and </head> tags.

Code:
<style type='text/css'>
    table, td {
        border: 1px solid black;
    }
</style>
That border applies to all <table> and <td> elements in a given document.

HTH!

Regards,
Rich

--
[http://www.smilingsouls.net]
Mail_IMAP: A PHP/C-Client/PEAR solution for webmail
Author: Beginning CSS: Cascading Style Sheets For Web Design
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #3 (permalink)  
Old February 23rd, 2006, 05:02 PM
Friend of Wrox
Points: 1,272, Level: 14
Points: 1,272, Level: 14 Points: 1,272, Level: 14 Points: 1,272, Level: 14
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: , , .
Posts: 423
Thanks: 0
Thanked 0 Times in 0 Posts
Default

CSS handles borders os TABLE and TD (and TH) separately.

For all tables.
table,td,th { border: 2px solid #f00 }

If you want to affect just one table, you have to use a more specific selector (for instance by giving the table an id or class).

http://www.w3.org/TR/REC-CSS2/tables.html

--
http://yupapa.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #4 (permalink)  
Old February 23rd, 2006, 05:03 PM
Friend of Wrox
Points: 1,272, Level: 14
Points: 1,272, Level: 14 Points: 1,272, Level: 14 Points: 1,272, Level: 14
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: , , .
Posts: 423
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hee-hee! You got me this time, Richard. :D

--
http://yupapa.com
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Change the backround color to cell ricespn Beginning VB 6 0 November 4th, 2006 12:39 PM
change cell color martin1 Visual Basic 2005 Basics 2 October 4th, 2006 09:55 AM
Change Cell Color phungleon HTML Code Clinic 2 April 9th, 2006 01:36 AM
border color on <select> cilla HTML Code Clinic 1 November 3rd, 2004 02:33 PM
change background color of cell based on value vurtman ASP.NET 1.0 and 1.1 Basics 4 February 26th, 2004 03:52 PM



All times are GMT -4. The time now is 12:49 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
© 2008 Wiley Publishing, Inc