Clarity StrategicTM

....bringing clear sight to your business

Home About Publications How to make hovercards

How to make hovercards

E-mail Print PDF
User Rating: / 2
PoorBest 

You've seen hovercards on social media platforms such as Twitter and Facebook, where if you mouseover your friend's name, a pop-up box shows some of the friend's info. What a useful tool, for ever so many reasons!

Here is a hovercard in absolute position on the page:

And here is a hovercard positioned relative to the text link:

Now here's the CSS for both, with a brief explanation:

/* Ron's Hovercards example - absolute position */

div#cards a { font: 10px Verdana, sans-serif; text-decoration: none; } 
div#cards a:hover { color: black; background: #cccccc; }
div#cards a span { display: none; }
div#cards a:hover span { display: block;
   position: absolute; top: 0px; left: 400px; 
   padding: 5px; margin: 10px; z-index: 100; width: 420px;
   color: black; background: white; border: 5px solid #ccccff;
   font: 10px Verdana, sans-serif; text-align: left; }
div#cards a:hover span img { height: 75px; }

/* Ron's Hovercards example - relative position */

div#cards1 a { font: 10px Verdana, sans-serif; text-decoration: none; } 
div#cards1 a:hover { color: black; background: #cccccc; }
div#cards1 a span { display: none; }
div#cards1 a:hover span { display: block;
   position: relative; top: -25px; left: 100px; // was position absolute, top auto
   padding: 5px; margin: 10px; z-index: 100; width: 420px;
   color: black; background: white; border: 5px solid #ccccff;
   font: 10px Verdana, sans-serif; text-align: left; }
div#cards1 a:hover span img { height: 75px; }

CSS must actually be something you have control over before you can make your own hovercards. I've done it on Wordpress and Joomla blogs, but I have to be able to edit the CSS to make changes. If (for instance) you have a Wordpress blog and Wordpress hosts it, you'll have to find a plugin to create these.

Now notice the major differences between the two examples:

  • To maintain the hovercard near the text, you use the parameter top: auto. Otherwise, if you define the top position, the top of the hovercard goes to that place on the page. The top of the remote hovercard here goes to 0px - the top of the page.
  • The left position of the nearby hovercard is ignored, because... I want it near the text. The remote hovercard will cover the blog name over if I don't push it off to the right.
  • The remote hovercard has a z-index of 100. Its position has priority over the position of everything else. It just gets laid over the top of every other element. The nearby hovercard, which has a z-index of 0, is at the same position priority as everything around it. I've found that there's not that much need to muck around with z-index for this problem.

Everything else:

  • I've chosen the font style, size, and color, and left no underscore for the link.
  • The hovercard is set to display when you hover over the link (display: block) and not to display any other time (display: none).
  • It's all in a little box, so I can choose the box size (I didn't fool with width here), border width and color, margin (within the blog post) and padding (inside the box itself), and stuff like that.

I'll say here that I didn't invent any of these design elements. All I did was throw the work of others together in a way that looks a little like the hovercards the social media platforms use. But here is a site that taught me a lot, in case you're a learner.

You can do all this yourself, but it requires you get in there and code just a little. If you're not comfortable with that, and you can't find a plugin, you may have to pay for someone to do it. This is, for instance, one of the things Clarity Strategic will include in a blog design, if you want it, at a reasonable price.

Last Updated ( Tuesday, 01 May 2012 07:25 )  

Smart Bookmarker


On Sale

Stress-Free Entrepreneurship

Take care of your new company; take care of yourself

46-page PDF, $10

When Things Break

How engineered systems fail; how to guard against failures; how to respond to failures

65-page PDF, $10

Clarity Strategic is about helping you find your way, and helping others find you.

Clarity Strategic Services

Twitter Starter Package $250

Facebook Fan Page Package $100

Wordpress package $250

Your First Wikipedia Page $250 (this is your history, not a marketing tool)

Your First Business Plan $250

Your First Marketing Plan $250

Your First Manufacturing Plan $250

Technical Writing and Editing $1-2/page

Coaching, Facilitating, Teaching $80/hour plus travel

Twitter/Facebook Campaign, varies by post volume and reach

Overall Social Media/Business Strategy, varies by the size of your business and the size of your vision

Custom graphics extra

To learn more about Clarity Strategic, e-mail Ron Graham, ron@claritystrategic.com, or call 330.294.8000.


   Copyright © by claritystrategic.com | Site by Ron Graham | Based on Joomla template JA_Purity
   Clarity Strategic, Akron, OH USA | 330.294.8000 | info@claritystrategic.com