Forums

  • # March 6, 2013 at 2:24 am

    Hello everyone,

    I’m curious if there is a better way of writing the following code…which uses the same :hover color for both classes…

    .arrow:hover, .icon:hover { color: red; }

    Any suggestions are appreciated. Thanks

    # March 6, 2013 at 2:43 am

    In pure CSS you don’t have that many options, so that is about the only way.

    There are tools that extend CSS such as SASS: http://sass-lang.com/
    Gives you variables and other cool stuff, but has requirements to get it running and you’ll need to generate the final CSS file once you’re done with changes. That is an extra step.

    # March 6, 2013 at 11:11 am

    You won’t go any further with vanilla CSS. Your code is perfectly good.

    With a preprocessor, you could do something like this:

    .arrow, .icon {
    &:hover {
    color: red;
    }
    }

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

icon-anchoricon-closeicon-emailicon-linkicon-logo-staricon-menuicon-nav-guideicon-searchicon-staricon-tag