CSS Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
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 13th, 2004, 06:07 AM
annihilate's Avatar
annihilate annihilate is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Location: Surrey, UK
Posts: 216 annihilate User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 3 h 21 m 19 sec
Reputation Power: 5
CSS and tables problem

Hello there, at the moment I have this CSS which I apply to a table cell by <a class='menulink' href='etc etc'

Code:
A.menulink {
	TEXT-DECORATION: none;
	display:block; 
	width:138px;
	BACKGROUND-COLOR: #666666;
	padding: 0px;
}
A.menulink:link {
	TEXT-DECORATION: none;
	display:block; 
	width:138px;
	BACKGROUND-COLOR: #666666;
	padding: 0px;
}
A.menulink:visited {
	TEXT-DECORATION: none;
	display:block; 
	width:138px;
	BACKGROUND-COLOR: #666666;
	padding: 0px;
}
A.menulink:active {
	TEXT-DECORATION: none;
	display:block; 
	width:138px;
	BACKGROUND-COLOR: #666666;
	padding: 0px;
}
A.menulink:hover {
	TEXT-DECORATION: none;
	display:block; 
	width:138px;
	BACKGROUND-COLOR: #000000;
	padding: 0px;
}


The problem I have is with the width:138px. If I apply this class to a cell that isn't 138px, it automatically goes that size. And if I delete the width:138px lines, then the class only works when you go over the word, not when you hover over the cell. So does anybody know how to change the CSS so that a width doesn't have to be defined so that I can apply the class to any size cell?

Thanks

Reply With Quote
  #2  
Old March 13th, 2004, 06:09 AM
annihilate's Avatar
annihilate annihilate is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Location: Surrey, UK
Posts: 216 annihilate User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 3 h 21 m 19 sec
Reputation Power: 5
Just had a thought. If I change the width line to 100%, that should work. I'll give it a try now.

It does :-)

Last edited by annihilate : March 13th, 2004 at 06:18 AM. Reason: Found the solution

Reply With Quote
  #3  
Old March 13th, 2004, 06:41 AM
Akh's Avatar
Akh Akh is offline
|<.+#f@#+.&.|
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Mar 2002
Location: norway
Posts: 2,685 Akh User rank is Colonel (50000 - 60000 Reputation Level)Akh User rank is Colonel (50000 - 60000 Reputation Level)Akh User rank is Colonel (50000 - 60000 Reputation Level)Akh User rank is Colonel (50000 - 60000 Reputation Level)Akh User rank is Colonel (50000 - 60000 Reputation Level)Akh User rank is Colonel (50000 - 60000 Reputation Level)Akh User rank is Colonel (50000 - 60000 Reputation Level)Akh User rank is Colonel (50000 - 60000 Reputation Level)Akh User rank is Colonel (50000 - 60000 Reputation Level)Akh User rank is Colonel (50000 - 60000 Reputation Level)Akh User rank is Colonel (50000 - 60000 Reputation Level)Akh User rank is Colonel (50000 - 60000 Reputation Level) 
Time spent in forums: 4 Weeks 6 h 17 m 10 sec
Reputation Power: 594
yeah, width 100% should work, but you don't have to supply a width, as a block-elemet has width 100% by default

by the way you could cut down a bit of that css,
a most of the style is inherit.
just remember to supply a color, when you set a background color,

aslo remember the correct order of the pseudo-classes

a:link
a:visited
a:hover
a:active
http://www.w3.org/TR/CSS2/selector....-pseudo-classes

Code:
A.menulink {
	TEXT-DECORATION: none;
	display:block; 
	BACKGROUND-COLOR: #666666;
	padding: 0px;
}
A.menulink:link {
	BACKGROUND-COLOR: #666666;
	
}
A.menulink:visited {
	BACKGROUND-COLOR: #666666;
	
}

A.menulink:hover {
	BACKGROUND-COLOR: #000000;

}

A.menulink:active {
	BACKGROUND-COLOR: #666666;
	
}

Last edited by Akh : March 13th, 2004 at 06:43 AM.

Reply With Quote
  #4  
Old March 13th, 2004, 06:54 AM
annihilate's Avatar
annihilate annihilate is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Location: Surrey, UK
Posts: 216 annihilate User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 3 h 21 m 19 sec
Reputation Power: 5
Thanks for your reply. I will cut down some of the CSS like you said. However, I tried removing all the 'width' lines and it didn't work properly. The cell only changed colour when the mouse went over the text in the cell that had the hyperlink. I want the whole cell to be a hyperlink, and for that to work, a width must be specified. So I have it at 100% and it all works fine now.

Reply With Quote
  #5  
Old March 13th, 2004, 07:38 AM
Akh's Avatar
Akh Akh is offline
|<.+#f@#+.&.|
Dev Shed Frequenter (2500 - 2999 posts)
 
Join Date: Mar 2002
Location: norway
Posts: 2,685 Akh User rank is Colonel (50000 - 60000 Reputation Level)Akh User rank is Colonel (50000 - 60000 Reputation Level)Akh User rank is Colonel (50000 - 60000 Reputation Level)Akh User rank is Colonel (50000 - 60000 Reputation Level)Akh User rank is Colonel (50000 - 60000 Reputation Level)Akh User rank is Colonel (50000 - 60000 Reputation Level)Akh User rank is Colonel (50000 - 60000 Reputation Level)Akh User rank is Colonel (50000 - 60000 Reputation Level)Akh User rank is Colonel (50000 - 60000 Reputation Level)Akh User rank is Colonel (50000 - 60000 Reputation Level)Akh User rank is Colonel (50000 - 60000 Reputation Level)Akh User rank is Colonel (50000 - 60000 Reputation Level) 
Time spent in forums: 4 Weeks 6 h 17 m 10 sec
Reputation Power: 594
yeah, it might not work in msie,
but in all the other browsers mozilla, opera & konq,
it works fine without supplying a width.

Reply With Quote
  #6  
Old March 13th, 2004, 11:41 AM
kk5st's Avatar
kk5st kk5st is offline
Thanks Johnny Hart (BC) R.I.P.
Dev Shed Demi-God (4500 - 4999 posts)
 
Join Date: May 2003
Location: Dallas
Posts: 4,588 kk5st User rank is Brigadier General (60000 - 70000 Reputation Level)kk5st User rank is Brigadier General (60000 - 70000 Reputation Level)kk5st User rank is Brigadier General (60000 - 70000 Reputation Level)kk5st User rank is Brigadier General (60000 - 70000 Reputation Level)kk5st User rank is Brigadier General (60000 - 70000 Reputation Level)kk5st User rank is Brigadier General (60000 - 70000 Reputation Level)kk5st User rank is Brigadier General (60000 - 70000 Reputation Level)kk5st User rank is Brigadier General (60000 - 70000 Reputation Level)kk5st User rank is Brigadier General (60000 - 70000 Reputation Level)kk5st User rank is Brigadier General (60000 - 70000 Reputation Level)kk5st User rank is Brigadier General (60000 - 70000 Reputation Level)kk5st User rank is Brigadier General (60000 - 70000 Reputation Level)kk5st User rank is Brigadier General (60000 - 70000 Reputation Level) 
Time spent in forums: 1 Month 2 Days 17 h 2 m 32 sec
Reputation Power: 662
MSIE shrink-wraps. The converse is that it expands elements to contain the content.

cheers,

gary
__________________
There are those who manage to build a web site without knowing what they're doing; thereby proving to themselves they do, indeed, know what they're doing.

My html and css workshop, demos and tutorials.
Ask a better question, get a better answer.

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignCSS Help > CSS and tables problem


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 | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
Stay green...Green IT