Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

CSS Forum


You are currently viewing our CSS Forum as a guest. Please register to participate.
Login



Reply
Where do I put the "class" in a table?
Old 12-07-2005, 01:38 PM Where do I put the "class" in a table?
Novice Talker

Posts: 9
Trades: 0
where do I put the "class" in the table?

the table code is

<p>
<table cellspacing="0" width="100%" border="0">
<tr>
<td width="100%" valign="top" align="left">
A
<br />
B
</td>

</tr>
</table>
</p>
valdez is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 12-07-2005, 01:43 PM
praveen's Avatar
Life is a Dream

Posts: 3,591
Name: Praveen
Location: Chennai, India
Trades: 0
p>
<table cellspacing="0" width="100%" border="0" class="whatever">
<tr>
<td width="100%" valign="top" align="left">
A
<br />
B
</td>

</tr>
</table>
</p>
__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
praveen is offline
Reply With Quote
View Public Profile
 
Old 12-07-2005, 02:05 PM
Novice Talker

Posts: 9
Trades: 0
that's what I thought and I tried that and it still doesn't show the css for the table.
valdez is offline
Reply With Quote
View Public Profile
 
Old 12-07-2005, 02:49 PM
funkdaddu's Avatar
Web Design Snob

Posts: 635
Trades: 0
what are the class's properties? is your CSS code right for a class? .classname { }
funkdaddu is offline
Reply With Quote
View Public Profile Visit funkdaddu's homepage!
 
Old 12-07-2005, 02:56 PM
praveen's Avatar
Life is a Dream

Posts: 3,591
Name: Praveen
Location: Chennai, India
Trades: 0
if u post ur css code as well we might be able to see whats the reason
__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
praveen is offline
Reply With Quote
View Public Profile
 
Old 12-07-2005, 06:36 PM
0beron's Avatar
Defies a Status

Posts: 1,832
Location: Somewhere else entirely
Trades: 0
The way I usually do tables is to assign a class to the table itself, and then add another css rule that determines the style of <td>s inside that class of table:

Code:
table.border { 
               border: ridge 2px orange;
               margin: 4px;
               padding: 0px;
}
.border td{
            border: ridge 2px orange;
            margin: 1px;
            padding: 5px;
}
That way all tds inside a table of class border get their style.
__________________
UPDATE 0beron SET talkupation = talkupation + lots WHERE post = 'helpful';

Please login or register to view this content. Registration is FREE
(aka MSN handwriting for forums)
0beron is offline
Reply With Quote
View Public Profile Visit 0beron's homepage!
 
Old 12-07-2005, 06:43 PM
madkad's Avatar
madkad-hosting.com

Posts: 310
Location: UK
Trades: 0
you can also do it this way

HTML Code:
<p>
<table cellspacing="0" width="100%" border="0">
<tr>
<td width="100%" valign="top" align="left" class="whatever">
A
<br />
B
</td>
</tr>
</table>
</p>
you will probly find that one will work ok for text cell color row color etc etc.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE

Great Hosting For You
madkad is offline
Reply With Quote
View Public Profile Visit madkad's homepage!
 
Old 12-07-2005, 11:01 PM
0beron's Avatar
Defies a Status

Posts: 1,832
Location: Somewhere else entirely
Trades: 0
Yeah you can assign the class to the tds individually, but if its a big table it becomes an absolute pain to type class="whatever" every time. Even if the HTML is dynamically generated, you get cleaner HTML source by using CSS to do the nesting for you.
__________________
UPDATE 0beron SET talkupation = talkupation + lots WHERE post = 'helpful';

Please login or register to view this content. Registration is FREE
(aka MSN handwriting for forums)
0beron is offline
Reply With Quote
View Public Profile Visit 0beron's homepage!
 
Old 12-08-2005, 03:51 AM
Mooofasa's Avatar
Defies a Status

Posts: 1,611
Name: Michael (mik) Land
Location: England
Trades: 0
Personally, I don't use tables, but I know about them.

Make sure that you have linked your HTML file to your CSS properly.
HTML Code:
<link rel="stylesheet" type="text/css" href="./whatever.css">
__________________

Please login or register to view this content. Registration is FREE
- Tumblog with thoughts, quotes, links, videos, images and my creations.

Please login or register to view this content. Registration is FREE
- The best free web browser.

Please login or register to view this content. Registration is FREE
- Firefox is now Firefail.
Mooofasa is offline
Reply With Quote
View Public Profile Visit Mooofasa's homepage!
 
Old 12-08-2005, 02:41 PM
Novice Talker

Posts: 9
Trades: 0
I figured it out. I enclosed the table with the paragraph tag.
my code was:

<table>
<tr><td>something</td></tr>
</table>

I simply surrounded it with the paragraph tag

<p class="something">
<table>...</table>
</p>

thanks. and I also switched to a more css based layout
again thanks
valdez is offline
Reply With Quote
View Public Profile
 
Old 12-08-2005, 02:45 PM
praveen's Avatar
Life is a Dream

Posts: 3,591
Name: Praveen
Location: Chennai, India
Trades: 0
that is an improper way to do it.

different browsers will interpret is differently and it will produce undesirable results.

what you have done is assign a paragraph element a class and not for the table.

to assign class to table u need to do it the way mentioned above.

maybe do a read about the css class and stuff before u decide to change everything arnd.

if u want the css effect on "something" you can do it this way

<td class> something</td>

ur choice if u want to do it this way or your "figured out" way..
__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
praveen is offline
Reply With Quote
View Public Profile
 
Old 12-08-2005, 03:08 PM
funkdaddu's Avatar
Web Design Snob

Posts: 635
Trades: 0
Here is an example of the proper way to do it:

HTML Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>

	<head>
		<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
		<title>Untitled Page</title>
		<style type="text/css" media="screen">
			<!--
.myclass {
	border: dashed 3px #9b0000
	}

td {
	background-color: #f2ebd8
	}

-->
		</style>
	</head>

	<body bgcolor="#ffffff">
		<table class="myclass" width="180" border="0" cellspacing="2" cellpadding="0">
			<tr>
				<td>1</td>
				<td>2</td>
				<td>3</td>
			</tr>
			<tr>
				<td>4</td>
				<td>5</td>
				<td>6</td>
			</tr>
			<tr>
				<td>7</td>
				<td>8</td>
				<td>9</td>
			</tr>
		</table>
	</body>

</html>
funkdaddu is offline
Reply With Quote
View Public Profile Visit funkdaddu's homepage!
 
Old 12-08-2005, 08:13 PM
0beron's Avatar
Defies a Status

Posts: 1,832
Location: Somewhere else entirely
Trades: 0
That gives all the tds a background, regardless of the class of table they are in. If you make a .myclass td {} rule then you can get the right result with a myclass table, but still put a table with a different class or no class in the same document without the td class affecting it. (Or with a different td class affecting it, eg you can add a .myclass2{} and a .myclass2 td {} and they won't then clash)
__________________
UPDATE 0beron SET talkupation = talkupation + lots WHERE post = 'helpful';

Please login or register to view this content. Registration is FREE
(aka MSN handwriting for forums)
0beron is offline
Reply With Quote
View Public Profile Visit 0beron's homepage!
 
Old 12-08-2005, 10:56 PM
funkdaddu's Avatar
Web Design Snob

Posts: 635
Trades: 0
Yup, i though he was just asking about just styling the table, so I didn't think much when I threw that td style in.
funkdaddu is offline
Reply With Quote
View Public Profile Visit funkdaddu's homepage!
 
Reply     « Reply to Where do I put the "class" in a table?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.48471 seconds with 12 queries