MyBB Community Forums

Full Version: Link boxes with hover effects
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
This probably seems like a newbish tutorial, but I think this is a handy thing for most beginners to know.

If you want your text link to be surrounded by a box, like this:
[Image: 24e4xhk.jpg]

and to look like this when 'hovered upon':
[Image: r8w80m.jpg]

then keep reading.

It's very simple (once again, I know it's pretty newbish Toungue) and involves only some extremely short lines of CSS.

-

Below is the CSS for all link types in the panel section.

#panel a {
	background: #ff438a url(images/panelabg.gif) repeat-x;
	color: #fff;
	border: 1px solid #d95200;
	padding: 4px;
}

The above code generates this:
[Image: 24e4xhk.jpg]

so, if that's all you want (with no hover effects) you're done! But, you need this CSS if you want hover effects:

#panel a:hover {
	background: #fff;
	color: #9f013d;
	border: 1px solid #d95200;
	padding: 4px;
	text-decoration: none;
}

and that generates this:
[Image: r8w80m.jpg].

So, the HTML for this would just be a simple <div id="panel"><a href=""></a></div>.

So, yeah... pretty newbish, I know, but I find it handy when you're looking for a quick way to spice up links. Good for beginners Toungue Obviously this can be used for regular text as well, because it's just changing the background. I really only posted this because I used to think when I first started something like this needed jQuery or something- it doesn't Toungue
Very nice. I wish I had found something like this when learning things.

Although the correct HTML for the CSS to work would be <div id="panel><a href=""></a></div> because you styled the anchor tag for the panel id. I'm sure you know that, but beginners probably don't and it might confuse them. Toungue
(2011-04-24, 10:21 AM)faviouz Wrote: [ -> ]Very nice. I wish I had found something like this when learning things.

Although the correct HTML for the CSS to work would be <div id="panel><a href=""></a></div> because you styled the anchor tag for the panel id. I'm sure you know that, but beginners probably don't and it might confuse them. Toungue

I should add that Smile thanks!
I'm More than new. so tell me where I can find the codes??? step by step.
thanks in advance
W3 Schools is an excellent resource for many web languages.