Web Design Forum: I have more than one table on my site but I wish to style one in particular.. - Web Design Forum

Jump to content

WDF
WDF Premium Memberships Reseller Hosting
Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

I have more than one table on my site but I wish to style one in particular..

#1 User is offline   web-rookie 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 52
  • Joined: 17-April 08
  • Reputation: 0
  • Gender:Male
  • Experience:Beginner
  • Area of Expertise:Web Designer

Posted 02 February 2012 - 02:18 PM

I have several tables on my site and I am styling them using
a global style for th, td, tr etc.

However I wish to single out one of these tables and apply a unique border. How do I do this?

That is my css for ALL tables:

#content table { border: 3px solid #FFF; }
#content table tr th { color: #FFF; background-color: #2a2d32; font-size:12px;}
#content table tr td, #content table tr th { border: 1px solid #FFF; padding: 5px; text-align: center; line-height: 1.4em; font-size:12px;}



and here is the html for the table in question:

<table  cellspacing="0" cellpadding="0" width="100%" >
		<tr style="background-color:#ebe7e5;">
			<td>Income </td>
			<td>€ </td>
			<td>€ </td>
		</tr>
		<tr class="PL">
			<td>Sales</td>
				<td><?php echo $cBalance; ?>3,549</td>
				<td></td>
		</tr>
		<tr >
			<td>Other</td>
				<td><?php echo $cMarketShare; ?>156</td>
				<td></td>
		</tr>
		<tr>
			<th><strong>Total Income</strong></th>
					<th></td>
					<th><?php echo $pProductionCapacity; ?>3,705</th>
			</tr>
			
		<tr style="background-color:#ebe7e5;">
			<td>Expenses </td>
			<td>€ </td>
			<td>€ </td>
		</tr>
</table>


Thanks for the input,
Webrookie

This post has been edited by Renaissance-Design: 02 February 2012 - 03:15 PM
Reason for edit: Please use the code button or tags to format your code.

0

#2 User is online   Renaissance-Design 

  • Available for custom WordPress work
  • View blog
  • Group: Moderators
  • Posts: 3,592
  • Joined: 12-August 10
  • Reputation: 559
  • Gender:Male
  • Location:South Wales
  • Experience:Web Guru
  • Area of Expertise:Designer/Coder

Posted 02 February 2012 - 03:16 PM

Give the table an ID and target that with your style declarations. Any rules you set on #content #uniquetable will override #content #table because an ID selector is more specific than an element.

This post has been edited by Renaissance-Design: 02 February 2012 - 03:17 PM

0

#3 User is offline   NoClass 

  • Forum Newcomer
  • Pip
  • Group: Members
  • Posts: 79
  • Joined: 07-February 12
  • Reputation: 6
  • Gender:Not Telling
  • Location:Surrey
  • Experience:Nothing
  • Area of Expertise:Web Designer

Posted 09 February 2012 - 12:57 AM

View Postweb-rookie, on 02 February 2012 - 02:18 PM, said:


#content table { border: 3px solid #FFF; }
#content table tr th { color: #FFF; background-color: #2a2d32; font-size:12px;}
#content table tr td, #content table tr th { border: 1px solid #FFF; padding: 5px; text-align: center; line-height: 1.4em; font-size:12px;}
#content #uniqueref table { border: 3px solid #CCC; }




What he said, something like this however if you need two tables out of 10 in a page to be different then go for class over id. :D
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users