TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
Advertisement
Associates
Associates
techtuts Darkmindz
CSS Tutorials Tutorialsphere.com - Free Online Tutorials
Boston PHP SurfnLearn
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 11-18-2007, 01:09 AM   #1 (permalink)
The Frequenter
Prolific Welcomer Upcoming Programmer 
 
Join Date: Sep 2007
Posts: 349
Thanks: 24
Haris is on a distinguished road
Default CSS Link Patterns

Can't remember the link patterns to style links? You can easily remember the link patterns by an easy relationship.

LoVe HAte
a:link, a:visited, a:hover, a:active

This LoVe HAte relationship will help you remember the link patterns forever. :p
Haris is offline  
Reply With Quote
Old 11-18-2007, 01:21 AM   #2 (permalink)
The Contributor
Upcoming Programmer 
 
Matt83's Avatar
 
Join Date: Oct 2007
Location: Argentina
Posts: 72
Thanks: 18
Matt83 is on a distinguished road
Default

:D lol, nice
__________________
http://www.mattvarone.com
Matt83 is offline  
Reply With Quote
Old 11-19-2007, 08:55 PM   #3 (permalink)
The Acquainted
 
wGEric's Avatar
 
Join Date: Nov 2007
Posts: 125
Thanks: 0
wGEric is on a distinguished road
Default

That is good. usually I just do <em>a</em> and that covers everything. Then do a a:hover for the hover.
__________________
Eric
BlogphpBB
wGEric is offline  
Reply With Quote
Old 11-20-2007, 12:14 AM   #4 (permalink)
La Vida es Sueño
Advanced Programmer Top Contributor 
 
Wildhoney's Avatar
 
Join Date: Sep 2007
Location: Oldham
Posts: 1,587
Thanks: 72
Wildhoney is on a distinguished road
Default

Am I being completely dim or does this not help one little bit? I can see your love hate thing, but it's not like the out-dated one for remembering the order of the planets. You still have to remember which letters to use from love hate. Surely it's easier to remember link, visited, hover, active.

...And for those who are wondering which planet one I mean. Well, this is the one I was taught at school:

My
Very
Easy
Method
Just
Speeds
Up
Naming
Planets
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
Send a message via AIM to Wildhoney Send a message via MSN to Wildhoney Send a message via Yahoo to Wildhoney
Wildhoney is online now  
Reply With Quote
Old 11-20-2007, 01:47 AM   #5 (permalink)
Moderateur
RegEx Guru PHP Guru Top Contributor Advanced Programmer 
 
Salathe's Avatar
 
Join Date: Apr 2007
Posts: 714
Thanks: 2
Salathe is on a distinguished road
Default

When learning CSS many moons ago, I was introduced to remembering "LoVe HAte" also and even now I almost unconsciously say to myself, when writing link styles, "love hate". Whatever works, works. :)

Just to clarify things a little about the utility of this topic. What we're discussing is the order in which CSS styles must be written in order to make the cascade useful for hyperlink styling. Certain pseudo-selectors occur when activity occurs on a hyperlink (hover, et al) but if you write them in the wrong order, one style will overrule another and won't produce the desired effect. A more thorough explanation comes from Eric Meyer on Link Specificity but essentially each of the link style types carry the same 'weight' so the last applicable one will be chosen.

Take the following CSS:
css Code:
/* LVAH = wrong */
a:link { colour: #69c; }
a:visited { color: #9c6; }
a:active { color: #000; }
a:hover { color: #c63; }

The "active" style will never be applied when a visitor clicks down onto the link, because the "hover" style will always overrule it since it is the last one in the list.

The way I generally apply my link styles is along the following pattern:
css Code:
a:link, a:visited { ... }
a:hover { ... }
a:active { ... }

This is pretty much following the LoVe/HAte pattern but since a link can never be both :link (ie, the default link state) and :visited (a visited link) we can safely join those styles together -- the usability people will cut my throat because I very often style unvisited and visited links in the same styles.
__________________
Salathe is online now  
Reply With Quote
Old 11-20-2007, 04:10 PM   #6 (permalink)
La Vida es Sueño
Advanced Programmer Top Contributor 
 
Wildhoney's Avatar
 
Join Date: Sep 2007
Location: Oldham
Posts: 1,587
Thanks: 72
Wildhoney is on a distinguished road
Default

The only reason I fail to see its practical use is that how do you know which letters in love and hate to use? If it was like a phrase with each word beginning with the letter, such as my conception:

Lonely
Vegans
Hoard
Apples

Then it'd make perfect sense and I'd be like, "Wey hey! Fantastic."
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
Send a message via AIM to Wildhoney Send a message via MSN to Wildhoney Send a message via Yahoo to Wildhoney
Wildhoney is online now  
Reply With Quote
The Following User Says Thank You to Wildhoney For This Useful Post:
Jay (12-08-2007)
Old 11-25-2007, 12:45 AM   #7 (permalink)
La Vida es Sueño
Advanced Programmer Top Contributor 
 
Wildhoney's Avatar
 
Join Date: Sep 2007
Location: Oldham
Posts: 1,587
Thanks: 72
Wildhoney is on a distinguished road
Default

No responses to mine? :( Well I liked it!
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
Send a message via AIM to Wildhoney Send a message via MSN to Wildhoney Send a message via Yahoo to Wildhoney
Wildhoney is online now  
Reply With Quote
Old 11-28-2007, 04:16 AM   #8 (permalink)
La Vida es Sueño
Advanced Programmer Top Contributor 
 
Wildhoney's Avatar
 
Join Date: Sep 2007
Location: Oldham
Posts: 1,587
Thanks: 72
Wildhoney is on a distinguished road
Default

I'm guessing everybody thinks mine sucks? :( You're all too polite to say something.
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
Send a message via AIM to Wildhoney Send a message via MSN to Wildhoney Send a message via Yahoo to Wildhoney
Wildhoney is online now  
Reply With Quote
Old 12-01-2007, 04:36 PM   #9 (permalink)
The Contributor
 
Join Date: Apr 2005
Posts: 29
Thanks: 0
Dr John is on a distinguished road
Default

Well, since you're after remembering link, visited, hover, active as the order n which to define the css styles, and each relevant initial letter only occurs once in LoveHate, its easy. Yes, I use LoveHate. I also use Trouble when setting padding and margins - Top, Right, Bottom, Left. Again each relevant letter only occurs once. Of course whatever you learn, once you've learned it, it works, and that's what matters.
__________________
www.kidneydialysis.org.uk
Dr John is offline  
Reply With Quote
Old 12-08-2007, 11:01 AM   #10 (permalink)
The Frequenter
Prolific Welcomer Upcoming Programmer 
 
Join Date: Sep 2007
Posts: 349
Thanks: 24
Haris is on a distinguished road
Default

Quote:
Originally Posted by Dr John View Post
Well, since you're after remembering link, visited, hover, active as the order n which to define the css styles, and each relevant initial letter only occurs once in LoveHate, its easy. Yes, I use LoveHate. I also use Trouble when setting padding and margins - Top, Right, Bottom, Left. Again each relevant letter only occurs once. Of course whatever you learn, once you've learned it, it works, and that's what matters.
I write all the patterns such as link pattern and margin/padding pattern at the top of my css file.
Haris is offline  
Reply With Quote
Old 12-10-2007, 06:17 AM   #11 (permalink)
The Acquainted
 
wGEric's Avatar
 
Join Date: Nov 2007
Posts: 125
Thanks: 0
wGEric is on a distinguished road
Default

Quote:
Originally Posted by Dr John View Post
Well, since you're after remembering link, visited, hover, active as the order n which to define the css styles, and each relevant initial letter only occurs once in LoveHate, its easy. Yes, I use LoveHate. I also use Trouble when setting padding and margins - Top, Right, Bottom, Left. Again each relevant letter only occurs once. Of course whatever you learn, once you've learned it, it works, and that's what matters.
With padding and margins, etc you could think of it like a clock. It starts at noon and rotates clock wise. I usually just remember it starts at the top and rotates to the right.
__________________
Eric
BlogphpBB
wGEric is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 11:47 PM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0