BACK
BACK
BACK
Loading...

Blog / HowTos /  How to Add Great Hover Effects CSS on Your Website

January 27, 2016 - Cathy

How to Add Great Hover Effects CSS on Your Website

Basic Hover Effects CSS Hover: Pseudo-Class Allows

One of the easiest effects to use on your website is hover effects. CSS pseudo-classes are “fake” classes that you can apply to any HTML element with the pseudo-class effect being triggered whenever a certain condition is met. The hover: pseudo-class was created with mouse use in mind and the hover effect is triggered when the user hovers their mouse over the element on a website. CSS effects hover: enables include:

  • Change link color on hover: The most common use for the hover effect
  • Outline image on hover: Images have a framed look when the mouse is hovered over the image
  • Change element background color on hover: Background changes color when the element is hovered
  • Tilt an Image on Hover: Rotates the image hovered over

These are just some of the hover effects CSS lets you use on your website. There are many others.

  • Creating Design of Sites

    Want a user-friendly website that’s easy on the eyes? Our team will personalize a website design for you and accurately identify what is most vital for the success of your site, making sure that you reach your target audience in whichever market you desire. Turning your dream of a website that can drive your business, into a reality.

How to Apply Hover Effects in CSS

By adding “:hover” after the element, ID or class name in the CSS rule a hover effect can be applied to any element on a website For example, to give every HTML paragraph on a page a red background when it’s hovered, write a CSS rule like the following:

p:hover { backgroundcolor:red; }

Every paragraph would have a red background when a reader hovers their cursor over the paragraph with that CSS in place. After the cursor moves off the paragraph the background would turn back to its original. That is the basic structure of a: hover rule. The following are some examples of CSS rules for other hover effects:

  1. Changing link color: CSS rules for four different states must be specified to style links properly:
    1. Link – The state when the link loads for the first time for the reader, before they hover or click on it.
    2. Visited – Sets how the link looks if the reader has already clicked on it
    3. Hover – The state when the cursor is over the link
    4. Active – Right when the link is clicked

hover effects css

This example shows how to set the colors for every state of all links on a site. To set the colors for specific links only, it is necessary to find the CSS selectors for those links.

a:link { color: black; }
a:visited { color: gray; }
a:hover { color: pink; }
a:active { color: yellow; }
  1. Rotate/tilt image: To rotate an image with the class “rotate” -15 degrees on hover
.rotate:hover {
-ms-transform:rotate(-15deg);
-webkit-transform:rotate(-15deg);
-moz-transform:rotate(-15deg);
-o-transform:rotate(-15deg);
transform: rotate(-15deg);
}
  1. Outline image: Every image with the class “.hover-outline” is given a 5 pixel gray outline that isoffset from the image by 10 pixels in this example:
.hoveroutline: hover {
outline: 5px solid gray;
outlineoffset:10px;
}
  1. Change element background color: In this example, everything with the class “background-switch” will start out with a background color of red, then switch to a background color of blue when hovered:
.backgroundswitch{ backgroundcolor:red; }
.backgroundswitch:hover { backgroundcolor:blue; }

There are a number of uses for hover effects on a website including:

  • Draw attention to a specific link or element
  • Provide information about links before they are clicked
  • Show users possibilities before committing to an action

A drawback of the hover effect is that mobile devices don’t have a mouse and work poorly or not at all for mobile devices. However, it is a CSS effect that is still widely used for the present.

To improve your website’s usability, try adding a CSS loading page.

Hire Ukrainian Developers at Low Rates

If you had a difficulty getting the results that you desired with our step-by-step tutorial or if you need help with more than just changing the hover effect on your website, you will be best served with hiring a professional developer. Our team will be more than happy to provide you with skilled and experienced web developer to assist you in improving your website. Hiring developers should come with quality work, trustworthy team, and fair cost. With Mobilunity, we have not only expert web developers with the skill set that you need, we also provide you the opportunity to hire such professionals at a low cost. We offer the remote services of our highly recommended web developers at an affordable rate! Nowadays, many startups hire developers in Berlin, as this country provide programmers of a high-quality. Although, the prices aren’t cheap at all. With us, a provider of Ukrainian coders, you can be assured of dedicated developers that improve your website, prioritize meeting your needs, and at a budget-friendly price!

And if you still need help with hover effects CSS after our detailed tutorial, don’t hesitate to get in touch!

Request a quote

Attach File

(max file size 5MB; allowed extensions: doc, txt, pdf, docx)

Contact us Request a Quote

Your email address will not be published.

Required fields are marked *

Attach File

(max file size 5MB; allowed extensions: doc, txt, pdf, docx)

subscribe to newsletter

Your email address will not be published.

Required fields are marked *

Ask a Question

Your email address will not be published.

Required fields are marked *

Sorry, this page isn't quite ready yet

redirecting to the old site

5

Mobilunity

cannot account for customer alterations, as the site may reflect changes made after the project was completed.

5