Applying CSS to a table separately

  • HKt0p5
  • Graduate
  • Graduate
  • User avatar
  • Joined: Mar 19, 2008
  • Posts: 134
  • Loc: Bulgaria
  • Status: Offline

Post August 20th, 2008, 5:00 am

I wanted to ask, is there some sort of markup to apply CSS to a single table. The case is that I have two tables. The one is normal HTML table but to make the second one look like I want it to, it has to be with CSS. But if I add table CSS in the <head> it messes up my first table.

Is there some way to apply CSS only to the second table? For example, something like <table style [something..] src="somecssfile.css"> ..or something like that?

I can't remake the entire layout because the two tables are completely different.
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post August 20th, 2008, 5:00 am

  • digitalMedia
  • a.k.a. dM
  • Genius
  • User avatar
  • Joined: Dec 29, 2003
  • Posts: 5169
  • Loc: SC-USA
  • Status: Offline

Post August 20th, 2008, 5:07 am

You should just add a class designation to the <table>...

Code: [ Select ]
<table cellpadding="0" cellspacing="0" class="unique_table_style">...


Then add definitions in your existing CSS...

Code: [ Select ]
table.unique_table_style{blah}
table.unique_table_style td{blah}
table.unique_table_style td a{blah}
  1. table.unique_table_style{blah}
  2. table.unique_table_style td{blah}
  3. table.unique_table_style td a{blah}
- dM
  • HKt0p5
  • Graduate
  • Graduate
  • User avatar
  • Joined: Mar 19, 2008
  • Posts: 134
  • Loc: Bulgaria
  • Status: Offline

Post August 20th, 2008, 5:43 am

Thanks! It seems to work, but I'll still need to figure out how to apply a fixed height of a td, I suppose it should be in CSS since the thing
Code: [ Select ]
<td height="3542">
works only for IE 5 and earlier. T_T
  • digitalMedia
  • a.k.a. dM
  • Genius
  • User avatar
  • Joined: Dec 29, 2003
  • Posts: 5169
  • Loc: SC-USA
  • Status: Offline

Post August 20th, 2008, 5:49 am

You can do this like so...

Code: [ Select ]
table.unique_table_style td{height:25px;}



Please check the rules regarding signatures - announcements-rules/ozzu-rules-and-regulations-t697.html. Thanks.
- dM
  • neksus
  • Mastermind
  • Mastermind
  • User avatar
  • Joined: Sep 10, 2004
  • Posts: 2194
  • Loc: Canada
  • Status: Offline

Post August 20th, 2008, 7:16 am

If it's unique the id tag might be more appropriate :)

CSS Code: [ Select ]
table#unique_table {
}
 
  1. table#unique_table {
  2. }
  3.  


HTML Code: [ Select ]
<table id="unique_table">
 
  1. <table id="unique_table">
  2.  
  • digitalMedia
  • a.k.a. dM
  • Genius
  • User avatar
  • Joined: Dec 29, 2003
  • Posts: 5169
  • Loc: SC-USA
  • Status: Offline

Post August 20th, 2008, 7:40 am

True that, neksus. However, not knowing too much about the goal, I think we'd have to assume the style could be used multiple times on a single page. Better to err on the safe side. :)
- dM
  • HKt0p5
  • Graduate
  • Graduate
  • User avatar
  • Joined: Mar 19, 2008
  • Posts: 134
  • Loc: Bulgaria
  • Status: Offline

Post August 22nd, 2008, 4:03 pm

Thanks, everyone. I made somehow a mix of CSS and normal formatting so seems like it'll be fine now. Thanks again!

This was the page with the tables and stuff.
http://hirasawa2032.com/main.html
  • Bogey
  • Bogey
  • Genius
  • User avatar
  • Joined: Jul 14, 2005
  • Posts: 8211
  • Loc: USA
  • Status: Offline

Post August 23rd, 2008, 7:24 pm

Sorry about this post being off-topic. What is hirasawa about anyway? Just curious... sounds like some top secret plan in action thing to me :lol:

[EDIT:] Is it the Electropop artist?
"Bring forth therefore fruits meet for repentance:" Matthew 3:8
  • HKt0p5
  • Graduate
  • Graduate
  • User avatar
  • Joined: Mar 19, 2008
  • Posts: 134
  • Loc: Bulgaria
  • Status: Offline

Post August 26th, 2008, 4:27 pm

Yes. He's my boss!
And the page is about all side-projects I'm working all by miself on in his stead.

Post Information

  • Total Posts in this topic: 9 posts
  • Users browsing this forum: No registered users and 95 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.