Applying CSS to a table separately

  • HKt0p5
  • Graduate
  • Graduate
  • User avatar
  • Posts: 135
  • Loc: Bulgaria

Post 3+ Months Ago

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
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • digitalMedia
  • a.k.a. dM
  • Genius
  • User avatar
  • Posts: 5149
  • Loc: SC-USA

Post 3+ Months Ago

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}
  • HKt0p5
  • Graduate
  • Graduate
  • User avatar
  • Posts: 135
  • Loc: Bulgaria

Post 3+ Months Ago

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
  • Posts: 5149
  • Loc: SC-USA

Post 3+ Months Ago

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.
  • neksus
  • Mastermind
  • Mastermind
  • User avatar
  • Posts: 2194
  • Loc: Canada

Post 3+ Months Ago

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
  • Posts: 5149
  • Loc: SC-USA

Post 3+ Months Ago

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. :)
  • HKt0p5
  • Graduate
  • Graduate
  • User avatar
  • Posts: 135
  • Loc: Bulgaria

Post 3+ Months Ago

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
  • Genius
  • Genius
  • Bogey
  • Posts: 8409
  • Loc: USA

Post 3+ Months Ago

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?
  • HKt0p5
  • Graduate
  • Graduate
  • User avatar
  • Posts: 135
  • Loc: Bulgaria

Post 3+ Months Ago

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 29 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
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.