CSS Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsWeb DesignCSS Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old March 25th, 2003, 03:55 PM
jjanes jjanes is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2002
Location: San Ramon, CA
Posts: 72 jjanes User rank is Private First Class (20 - 50 Reputation Level)jjanes User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 h 42 m 9 sec
Reputation Power: 12
Using CSS with TD tags

I am discovering the abilities of CSS and it is very interesting

I do have a question though

Cann CSS be used to do two different sets of things at once

A: allows you to manipulate text in an anchor tag in some desired way

A:hover modifesit when the mouse is over the anchor tag

TD will let you set different parameters

I would like to set a background image or color in TD tag which I think is very easy but I want to change to another image or color it when I move the mouse over the tag

almost like a

TD:hover

<STYLE>
TD {
background-color : #FFFF00;
}

TD.HOVER {
background-color : #FF00AA;
}
</STYLE>


I know this does not work but it may describe what I am trying to do in a better way

Thanks for your time

Last edited by jjanes : March 25th, 2003 at 03:57 PM.

Reply With Quote
  #2  
Old March 25th, 2003, 05:45 PM
Akh's Avatar
Akh Akh is offline
|<.+#f@#+.&.|
Dev Shed Loyal (3000 - 3499 posts)
 
Join Date: Mar 2002
Location: norway
Posts: 3,009 Akh User rank is General 4th Grade (Above 100000 Reputation Level)Akh User rank is General 4th Grade (Above 100000 Reputation Level)Akh User rank is General 4th Grade (Above 100000 Reputation Level)Akh User rank is General 4th Grade (Above 100000 Reputation Level)Akh User rank is General 4th Grade (Above 100000 Reputation Level)Akh User rank is General 4th Grade (Above 100000 Reputation Level)Akh User rank is General 4th Grade (Above 100000 Reputation Level)Akh User rank is General 4th Grade (Above 100000 Reputation Level)Akh User rank is General 4th Grade (Above 100000 Reputation Level)Akh User rank is General 4th Grade (Above 100000 Reputation Level)Akh User rank is General 4th Grade (Above 100000 Reputation Level)Akh User rank is General 4th Grade (Above 100000 Reputation Level)Akh User rank is General 4th Grade (Above 100000 Reputation Level)Akh User rank is General 4th Grade (Above 100000 Reputation Level)Akh User rank is General 4th Grade (Above 100000 Reputation Level)Akh User rank is General 4th Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 4 Days 17 h 35 m 11 sec
Reputation Power: 1223
hover on td elements
works fine in css-capable browsers
like mozilla or opera7,

though if you are stuck with ie, then you must find some workaround

Reply With Quote
  #3  
Old March 25th, 2003, 06:30 PM
kicken's Avatar
kicken kicken is offline
Wiser? Not exactly.
Dev Shed God 1st Plane (5500 - 5999 posts)
 
Join Date: May 2001
Location: Bonita Springs, FL
Posts: 5,654 kicken User rank is General 37th Grade (Above 100000 Reputation Level)kicken User rank is General 37th Grade (Above 100000 Reputation Level)kicken User rank is General 37th Grade (Above 100000 Reputation Level)kicken User rank is General 37th Grade (Above 100000 Reputation Level)kicken User rank is General 37th Grade (Above 100000 Reputation Level)kicken User rank is General 37th Grade (Above 100000 Reputation Level)kicken User rank is General 37th Grade (Above 100000 Reputation Level)kicken User rank is General 37th Grade (Above 100000 Reputation Level)kicken User rank is General 37th Grade (Above 100000 Reputation Level)kicken User rank is General 37th Grade (Above 100000 Reputation Level)kicken User rank is General 37th Grade (Above 100000 Reputation Level)kicken User rank is General 37th Grade (Above 100000 Reputation Level)kicken User rank is General 37th Grade (Above 100000 Reputation Level)kicken User rank is General 37th Grade (Above 100000 Reputation Level)kicken User rank is General 37th Grade (Above 100000 Reputation Level)kicken User rank is General 37th Grade (Above 100000 Reputation Level)  Folding Points: 2670569 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2670569 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2670569 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2670569 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2670569 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2670569 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2670569 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2670569 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2670569 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2670569 Folding Title: Super Ultimate Folder - Level 6
Time spent in forums: 2 Months 2 Weeks 2 Days 5 h 1 m 44 sec
Reputation Power: 3436
You could use some combination of CSS and JS. Something like so:

At the top of the page:
Code:
<style type="text/css">

TD {
     background-color: #fff;
     color: #000;
}

TD:hover {
     background-color: #000;
     color: #fff;
}
</style>

<script type="text/javascript">
var IE=(navigator.appName.indexOf('Microsoft') != -1);
</script>



Then on your <td> tags, use this onmouseover script.

Code:
<td onmouseover="if (IE){ this.style.backgroundColor='#000'; this.style.color='#fff'; }">....</td>


Give that a shot.

Reply With Quote
  #4  
Old March 26th, 2003, 12:50 PM
jjanes jjanes is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2002
Location: San Ramon, CA
Posts: 72 jjanes User rank is Private First Class (20 - 50 Reputation Level)jjanes User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 h 42 m 9 sec
Reputation Power: 12
I am stuck in IE so I tried the scripts and AND BAM IT WORKED

THANKS ALOT

that script worked GREAT I added a mouse out to turn it back to the orignal and it is working great

Damn now I have to go change all my websites to incorporate that script

Jeff

Reply With Quote
  #5  
Old March 26th, 2003, 08:19 PM
jjanes jjanes is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2002
Location: San Ramon, CA
Posts: 72 jjanes User rank is Private First Class (20 - 50 Reputation Level)jjanes User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 h 42 m 9 sec
Reputation Power: 12
I guess the person who wrote the last post missed my sarcasm.
I won't be sarcastic in this post.
I just implied I have a lot of sites I am planning on using this in.

I thank you again for your help it does work great. It will make my menu coding snippits much easier to use

Thank you again Akh and kicken

Reply With Quote
  #6  
Old March 27th, 2003, 01:13 PM
Hitman Nitro Hitman Nitro is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2002
Location: The Rock
Posts: 5 Hitman Nitro User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to Hitman Nitro
you can just specify a seperate class and use javascript to switch between them on whatever event you want. For example:
Code:
<html>
<head>
	<title>Untitled</title>
	<style type="text/css">
	<!--
	.BUTTONTABLE {
		BORDER:black solid 1px;
	}
	.BUTTON{
		BACKGROUND:red;
		COLOR:white;
		TEXT-ALIGN:center;
	}
	.BUTTONOVER {
		BACKGROUND:blue;
		COLOR:white;
		CURSOR:pointer;
		TEXT-ALIGN:center;
	}
	-->
	</style>
</head>

<body>

<table width="300" border="0" cellspacing="0" cellpadding="4" class="buttontable">
<tr>
	<td class="button" onmouseover="this.className='buttonover';" onmouseout="this.className='button';">Button 1</td>
	<td class="button" onmouseover="this.className='buttonover';" onmouseout="this.className='button';">Button 2</td>
	<td class="button" onmouseover="this.className='buttonover';" onmouseout="this.className='button';">Button 3</td>
</tr>
</table>

</body>
</html>

This page makes a simple horizontal nav bar (simply add <tr>s to create a vertical one) with 3 buttons on it that respond to the onmouseover and onmouseout events to create a nice simple rollover effect. There's nothing stopping you from using images for the background, different border colors, text effects, or anything else CSS supports in the definition either. You can also, of course, put the style definitions in a seperate linked .css document rather than in the <head> of the current document and it will still work.

It works with all the browsers I've tested it on too. You can even extend it further by specifying an "onclick" event in the TD to send you to your location of choice, rather than putting in normal <a href="... links (which would then have to be styled) within the <td>s.

Reply With Quote
  #7  
Old March 27th, 2003, 03:44 PM
jjanes jjanes is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2002
Location: San Ramon, CA
Posts: 72 jjanes User rank is Private First Class (20 - 50 Reputation Level)jjanes User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 h 42 m 9 sec
Reputation Power: 12
another great idea I knew I came to the right place

thanks again

never even thought about the onclick aspect thanks for that too

Jeff

Reply With Quote
  #8  
Old March 27th, 2003, 03:55 PM
jjanes jjanes is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2002
Location: San Ramon, CA
Posts: 72 jjanes User rank is Private First Class (20 - 50 Reputation Level)jjanes User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 h 42 m 9 sec
Reputation Power: 12
One question is it possible to makes changes to a 'parent tag'

such as
<table>
<tr>
<td class=abc> <---- this changes when anchor is rolledover
<a onmouseover=parenttd.className='class1' >xyx</a>
</td>
</tr>
</table>


when doing a mouseover of the anchor tag changes the class of the td tag that contains it

forgive my syntax but I think you understand what I am asking

Reply With Quote
  #9  
Old March 27th, 2003, 06:58 PM
kicken's Avatar
kicken kicken is offline
Wiser? Not exactly.
Dev Shed God 1st Plane (5500 - 5999 posts)
 
Join Date: May 2001
Location: Bonita Springs, FL
Posts: 5,654 kicken User rank is General 37th Grade (Above 100000 Reputation Level)kicken User rank is General 37th Grade (Above 100000 Reputation Level)kicken User rank is General 37th Grade (Above 100000 Reputation Level)kicken User rank is General 37th Grade (Above 100000 Reputation Level)kicken User rank is General 37th Grade (Above 100000 Reputation Level)kicken User rank is General 37th Grade (Above 100000 Reputation Level)kicken User rank is General 37th Grade (Above 100000 Reputation Level)kicken User rank is General 37th Grade (Above 100000 Reputation Level)kicken User rank is General 37th Grade (Above 100000 Reputation Level)kicken User rank is General 37th Grade (Above 100000 Reputation Level)kicken User rank is General 37th Grade (Above 100000 Reputation Level)kicken User rank is General 37th Grade (Above 100000 Reputation Level)kicken User rank is General 37th Grade (Above 100000 Reputation Level)kicken User rank is General 37th Grade (Above 100000 Reputation Level)kicken User rank is General 37th Grade (Above 100000 Reputation Level)kicken User rank is General 37th Grade (Above 100000 Reputation Level)  Folding Points: 2670569 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2670569 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2670569 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2670569 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2670569 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2670569 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2670569 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2670569 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2670569 Folding Title: Super Ultimate Folder - Level 6Folding Points: 2670569 Folding Title: Super Ultimate Folder - Level 6
Time spent in forums: 2 Months 2 Weeks 2 Days 5 h 1 m 44 sec
Reputation Power: 3436
Yes, different forms though. in IE you would use this.parentElement and in Gecko(Mozilla, NS, etc) you would use this.parentNode

So if you reuse that IE detect script from before, something like this should do it:

Code:
<table>
<tr>
<td class=abc> 
<a onmouseover="if (IE){
     this.parentElement.className='class1';
} else {
     this.parentNode.className='class1';
}">xyx</a>
</td>
</tr>
</table>

Reply With Quote
  #10  
Old March 27th, 2003, 07:22 PM
jjanes jjanes is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2002
Location: San Ramon, CA
Posts: 72 jjanes User rank is Private First Class (20 - 50 Reputation Level)jjanes User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 h 42 m 9 sec
Reputation Power: 12
OK thanks for ALL the help. I look forward to seemy web pages works as smoothly as I expect them to with the help of this information

Jeff

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignCSS Help > Using CSS with TD tags

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap