Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

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

Featured Replies

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

Edited by Renaissance-Design
Please use the code button or tags to format your code.

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.

Edited by Renaissance-Design

 

#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

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.