Round rim with gaps when hovered over

To help illustrate what I'm aiming for, here is a visual representation of what I want to achieve.

https://i.sstatic.net/WBqBx.jpg

Upon hovering over the box, my goal is to outline the gray image with a circular border. The image itself has been clipped using a path like this:

clip-path: circle(65px at center);

The accompanying markup is shown below:

<div class="artist-card">
  <div class="image-wrap">
    <img src="http://placehold.it/130x130" alt="artist name"/>
  </div>
</div>

I attempted to achieve this effect by adding a :hover state to the box and then styling the .image-wrap with padding: 5px; and a border-radius: 50%;, but things did not turn out as expected.

https://i.sstatic.net/xi9ch.jpg

Answer №1

Greetings! I trust this meets your requirements. In order to achieve the desired effect, I utilized the CSS property pointer-events: none for the .image-wrap class and pointer-events: auto for the img element, ensuring that the border is activated only when hovering over the image.

img {
  margin: auto;
  display: block;
  clip-path: circle(65px at center);
  pointer-events: none;
}

.image-wrap {
  display: flex;
  align-items:center;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  border: 3px solid transparent;
  pointer-events: none;
}

.artist-card {
  pointer-events: auto;
  background: grey;
  width: 155px;
  height: 155px;
}

.image-wrap:hover {
  border-color: yellow;
}

.artist-card:hover .image-wrap {
  border-color: yellow;
}
<div class="artist-card">
  <div class="image-wrap">
    <img src="http://placehold.it/130x130" alt="artist name"/>
  </div>
</div>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Utilizing the Power of ChartJs

I am currently in the process of developing a web application that will provide users with the ability to compare the number of calories they burn during exercise with the amount they consume in a meal. To achieve this goal, I have chosen to utilize ChartJ ...

What is the best way to arrange two images next to each other using HTML and CSS in order to effectively utilize a specified width?

I am trying to display two different images side by side within a DIV element that is exactly 800px wide. The images may have varying widths and heights, with some being wider than tall and others taller than wide. I have attempted to place both images i ...

What is the best way to achieve this effect with CSS?

Is there a way to create this design with CSS? I experimented with applying border CSS and rotating the DIV, but couldn't quite achieve the desired result. Here is an image for reference: https://i.stack.imgur.com/yW6wK.png ...

"Exploring the process of making Ajax calls to a specific URL using a

Hello there! I'm currently working on a project where I need to retrieve data without refreshing the page. Below is my ajax code: function fetchData() { $.ajax({ type: "post", cache: false, url: "test2.php", success: (function (resu ...

Intel XDK problem with HTML5/CSS3 footers overlapping headers in my project

I am in the process of developing an application using drag and drop features from the Intel XDK/App Designer. The main concept behind this app is to provide users with basic tutorials and incorporate geolocation services. My approach involved following th ...

The information retrieved from the database query is failing to appear on my webpage

I am encountering an issue where I am unable to display product details on my webpage in a specific format after submitting an ID number through a form. The query does not show any data when submitted. My objective is to append the latest retrieved data be ...

Having trouble with the auto suggest feature in PyCharm with Material Design Lite?

Struggling with setting up a fresh Django project in PyCharm and encountering issues with HTML code autocompletion. I've integrated Material Design Lite as the front-end framework, storing the files in a static folder within the project. I attempted ...

Persistent vertical menu dropdown that remains expanded on sub menu pages

I am struggling to understand how to keep my menu sub items open when on the active page. Although I have tried similar solutions, I have not been successful in implementing them. I apologize if this question has been asked before. My approach involves usi ...

Adjust the font size in CSS based on a specified range of values

When the screen size is small (mobile), the font size is fixed at 14px. On really large screens, the font size is set to 18px, ensuring it never goes below 14px or above 18px>. This is achieved using media queries.</p> <p>However, for the i ...

Issue with jQuery form submission not retrieving input value

[Beginner inquiry] I am using contact form 7 on my WordPress website. I have two input fields where I need to display the event title and price: if (window.location.href.indexOf("event") > -1) { var title = $('.entry-title').text(); var ...

Update overall font size to be 62% for a consistent look across the website

Recently, I developed a browser extension that adds an overlay button to the LinkedIn website. Everything was running smoothly until I discovered that LinkedIn uses a global font-size: 62,5% that completely messes up my design.. https://i.stack.imgur.com ...

Policy regarding copyright content removal and protection of privacy

In the majority of musical websites I have come across, they often mention the following in their policies: At this particular website (www.Indiamp3.com), you will find links that redirect to audio files. These files are hosted elsewhere on the internet a ...

How come @keyframes animations do not seem to cooperate with Vue.js?

I'm attempting to create a flashing link upon site load, but I'm encountering issues with the animation not working in Vue. Interestingly, when testing the same code without Vue in a separate file, it functions perfectly fine. Below is the spec ...

comparing multiple values separated by commas with JavaScript

I need validation using a comma-separated value format. Within the illustration, there are two fields: "Saloon Price" (value: 10,10,10,10) and "Saloon Offer Price" (value: 11,11,11,11). The first value must be less than the second. Saloon price Value & ...

Text within the div element causes the displacement of other adjacent div elements

When the text in mondaySpecial extends to a second line, it pushes tuesdaySpecial-saturdaySpecial further down on the page, disrupting the layout of the divs. The same issue occurs with other specials as well. Is there a way to prevent this from happening? ...

Populating a drop-down menu using Python requests in a select tag

I am attempting to select/enter a value into a dropdown menu using Python Requests, but for some reason it is not working. Here is the HTML code: <select name="hourly_rate" class="default-input" id="hourly_rate"> <o ...

Has there been a recent issue with FireFox 3 where it fails to clear a float and does not recognize negative margins?

I've been searching online, but haven't come across a definitive answer yet. I'm interested in knowing if there is an issue with Firefox 3 when applying a negative margin to a div that is either clearing a float or containing another floated ...

What strategies can I use to make my div content more adaptable to different screen sizes and

Currently, in my project, I have implemented a layout using the top nav menu (purple part) and the left menu (pink part) as shown in the image. However, I am facing an issue where, upon deleting some content from the view, the pink menu on the left extends ...

Guidelines for effectively adjusting Saas variables in Next.js using React-Bootstrap

Currently, I am tackling a fresh project in Next.js, and I'm encountering difficulties in personalizing the bootstrap sass variables within my project. I came across a reference on how to customize bootstrap at this link: . However, I encountered the ...

Tips for creating responsive text within a hero image

I'm exploring the world of creating responsive websites using Bootstrap, a new venture for me. One challenge I've encountered is trying to create a hero image with text positioned perfectly in the center. Despite my efforts, the text does not adj ...