Make CSS box change color onmouseover

I would like to have a CSS box, with a link in it. When I hover the mouse over the box, I would like to have the background color of the CSS box to change to a desired color and change back when the mouse is moved off.

I tried the action Target Show/Hide Layer, but can’t seem to get it to work. Also, is there a way to have have the text centered vertically/horizontally in the css box as well?

Thanks,
Bryan


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

The easiest, most browser-compatible way to do this is with CSS.
(Coincidentally, this will center your text as well.)

Draw your box, and while it is still selected, make sure the Layer
checkbox is on in the Inspector, and note (or change) the value in the
Inspector’s “Title” field. (Confusingly, this is where the ID is set
for an HTML box.)

Double-click into the box, type and link your link text (but do not
style it at all). Un-check the height attribute for the box.

Now, off to the Styles palette. Click on the cog menu, select New
Style. In the Tag field, enter a # followed by the name of your box, a
space, and an a. For example, if your box was called item4, you would
enter all of this exactly as written in the Tag field:

 #item4 a

Tab into the Name field, delete whatever is there, and then tab out
again to make sure it sticks.

Now click the Extended button, and enter the following name/value
pairs. (You will click New for each pair, a sub-sub-dialog will
appear, you will enter the name and value in their respective fields,
then Okay that dialog.)

name value
display block
text-align center
padding 8px 0
background-color #ff9

Now okay out of the stack of dialogs, and preview. You should see a
yellow box around your link, with 8px padding top and bottom (adjust
this dimension and the color to your liking). The box should be
adjustable for width by dragging the containing HTML box wider.

The rollover part is just adding one more style, exactly the same way
you made the first, but named

 #item4 a:hover

And the only property you need to add for this one is the background-
color. (And the font color if you want that to change at the same time.)

This should be the most browser-safe way to get this particular
effect, and since it doesn’t rely on JavaScript, you won’t need to
worry about accessibility issues either.

Walter

On Mar 12, 2009, at 10:17 AM, Bryan Los wrote:

I would like to have a CSS box, with a link in it. When I hover the
mouse over the box, I would like to have the background color of the
CSS box to change to a desired color and change back when the mouse
is moved off.


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Thanks Walter… that was going deeper than I’ve been with CSS. Off hand, do you know of a web site that lists all CSS extended attributes so I can try and learn more.

So I got this to work… now the next obvious question is… can you use a hover image? For instance, say my CSS box already has a background image. Can I set up a box that will change that background image on hover, and keep my links working the same way?

Bryan


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

One of the best expositions of CSS would be http://quirksmode.org . They cover everything, and also outline what works where.

As far as the hover image, just change the background-image property in the :hover state, and the images will swap. For a seamless experience, make the two backgrounds both part of the same image file, then just change the background-position in the :hover state to show the other half of the image. (This is referred to as the CSS Sprite technique.)

Walter


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

On 16 Mar 2009, at 00:29, Bryan Los wrote:

Off hand, do you know of a web site that lists all CSS extended
attributes so I can try and learn more.

If you Google ‘CSS attributes’, you’ll get enough to keep you reading
for a month :slight_smile:

This Dashboard widget is great, too: http://tr.im/hpyj

best wishes,

Paul Bradforth

http://www.paulbradforth.com


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Another very useful CSS widget, <Apple - Support - Downloads

.

Todd


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

on 16/03/2009 12:54, Todd at email@hidden wrote:

Another very useful CSS widget,
<Apple - Support - Downloads

.

Todd

Link broken on Apple site, tried other sources, but not found it.

Reported to Apple the broken link

Best wishes Peter

================================
Peter Tucker, Oxford UK email@hidden


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Hmmm. Well, if you need or want it contact me off-list and I’ll send a
copy. It’s free so I think that’ll be OK.

Todd

On Mar 16, 2009, at 8:59 AM, Peter Tucker wrote:

on 16/03/2009 12:54, Todd at email@hidden wrote:

Another very useful CSS widget,
<Apple - Support - Downloads

.

Todd

Link broken on Apple site, tried other sources, but not found it.

Reported to Apple the broken link


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

http://www.apple.com/downloads/dashboard/reference/seess.html

Works for me

David


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Hi David,

You don’t get a file not found error when clicking Download?

Joe

On 16 Mar 2009, at 20:31, DeltaDave wrote:

Apple - Support - Downloads

Works for me

David


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

To be honest I didn’t actually try and download it coz I had it already

You can get it from here http://www.deltadzine.net/downloads/SeeSS.wdgt.zip

David


freewaytalk mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options