Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 10-20-2010, 04:14 PM   #1
whorehole
Confirmed User
 
Join Date: Jan 2004
Posts: 299
A stupid CSS question- anybody know how?

This is something I've never figured out, I've researched it, but never found an answer- it may not even be possible, but I figured somebody on here would know if it is.


I've got a page all setup with tons of CSS.

but say I have one little bit of text that I want to make a color, and ALSO be hyperlinked, and have a seperate hovercolor.

I want to just code it inline using a SPAN tag, and not write a giant bunch of CSS code just for this one word.

So the text link should be white, and when hovered over, it would turn black.


This will turn the text white, etc:


<a href="http://www.myurl.com" ><span style="font-family: arial; font-weight: bold; font-size: 12px; color: white; ">CLICK HERE</span></a>


But can I define a hover color in that span tag?


I've never found any code that would do it..

can it be done?


Thanks for any help!
whorehole is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-20-2010, 04:38 PM   #2
prezzz
Confirmed User
 
Industry Role:
Join Date: Jul 2004
Posts: 959
If it's just one instance in the code, drop the span part, give the <a> an id and add 2 lines of code to the css file.

<a href="http://www.myurl.com" id="thisone">CLICK HERE</a>

a#thisone:link, a#thisone:visited { font: 700 12px Arial, sans-serif; color: #fff; }
a#thisone:hover, a#thisone:active { color: #000; }
prezzz is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-20-2010, 04:40 PM   #3
The Truth Hurts
Hb17uaaldwM
 
The Truth Hurts's Avatar
 
Industry Role:
Join Date: Nov 2002
Location: In Your Skull
Posts: 15,152
pretty sure you cant do pseudo shit inline.
add something like this silly shit to your anchor
onmouseover="this.style.color='value';"
onmouseout="this.style.color='value';"
The Truth Hurts is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-20-2010, 05:14 PM   #4
Amputate Your Head
There can be only one
 
Amputate Your Head's Avatar
 
Industry Role:
Join Date: Aug 2001
Location: Somewhere else
Posts: 39,075
Quote:
Originally Posted by The Truth Hurts View Post
pretty sure you cant do pseudo shit inline.
add something like this silly shit to your anchor
onmouseover="this.style.color='value';"
onmouseout="this.style.color='value';"
hey dude... haven't seen you around in a while.
__________________
SIG TOO BIG
Amputate Your Head is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-20-2010, 06:16 PM   #5
Why
MFBA
 
Industry Role:
Join Date: Mar 2003
Location: PNW
Posts: 7,230
i believe prezzz is correct... im sure there are other ways but thats the simple and straightforward answer.
Why is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-20-2010, 06:24 PM   #6
BestXXXPorn
Confirmed User
 
BestXXXPorn's Avatar
 
Join Date: Jun 2009
Location: Asheville, NC
Posts: 2,277
Quote:
Originally Posted by prezzz View Post
If it's just one instance in the code, drop the span part, give the <a> an id and add 2 lines of code to the css file.

<a href="http://www.myurl.com" id="thisone">CLICK HERE</a>

a#thisone:link, a#thisone:visited { font: 700 12px Arial, sans-serif; color: #fff; }
a#thisone:hover, a#thisone:active { color: #000; }
Perfect, there's no need for a span inside the anchor tag... Especially if you want a hover state as some browsers will only recognize anchors to have :hover...

I would probably opt for a class instead of an id in case you want to reuse it later:

<a href="http://www.whatever.com" class="blackWhite">Click Here</a>

a.blackWhite, a.blackWhite:visited { font: ...; color: #fff; }
a.blackWhite:hover, a.blackWhite:active { color: #000; }

Then you can just use the css class on any anchor tag you may want but for sure, as prezzz used... break it out into the style sheet. That way you can update it whenever you want without searching through mounds of copy...
__________________
ICQ: 258-202-811 | Email: eric{at}bestxxxporn.com
BestXXXPorn is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-20-2010, 08:48 PM   #7
FlexxAeon
Confirmed User
 
FlexxAeon's Avatar
 
Industry Role:
Join Date: May 2003
Posts: 3,765
Quote:
Originally Posted by BestXXXPorn View Post
Perfect, there's no need for a span inside the anchor tag... Especially if you want a hover state as some browsers will only recognize anchors to have :hover...

I would probably opt for a class instead of an id in case you want to reuse it later:

<a href="http://www.whatever.com" class="blackWhite">Click Here</a>

a.blackWhite, a.blackWhite:visited { font: ...; color: #fff; }
a.blackWhite:hover, a.blackWhite:active { color: #000; }

Then you can just use the css class on any anchor tag you may want but for sure, as prezzz used... break it out into the style sheet. That way you can update it whenever you want without searching through mounds of copy...
__________________
flexx [dot] aeon [at] gmail
FlexxAeon is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 10-21-2010, 10:15 PM   #8
whorehole
Confirmed User
 
Join Date: Jan 2004
Posts: 299
Thanks for the replies guys

I was trying to avoid using an id or class (or having to add shit to the css file) and just be able to whip it out right there on the line, but oh well

The Truth Hurts- I will try that technique
whorehole is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.