Generating a CSS pulsating animation starting from the border towards the center

I originally set out to create a code pen with the desired effect, which you can view here: https://codepen.io/oli_js/pen/KKPGZLm?editors=1100

However, the pulse effect in my code radiates outwards from the center point. What I actually want is for the inner circle to be transparent and have the effect emanate solely from the border.

Is there anyone out there who knows of any CSS sorcery that could achieve this mystical transformation?!

.pulse {
    border-radius: 50px;
    height: 80px;
    left: 50%;
    letter-spacing: 0.05em;
    line-height: 50px;
    position: absolute;
    text-align: center;
    text-transform: uppercase;
    top: 50%;
    width: 80px;
}

.pulse:after {
    -webkit-animation: pulse 2s infinite linear;
    background: red;
    border-radius: 50px;
    content: '';
    height: 100%;
    left: 0;
    opacity: 0;
    position: absolute;
    top: 0;
    width: 100%;
}

.button {
    background: transparent;
    border-radius: 100% 100%;
      width: 40px;
    height: 40px;
    left: 50%;
    border:2px solid red;
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%);
}

@-webkit-keyframes pulse{
  0% {transform:scale(0.5);
    opacity:0;}
  33% {transform:scale(0.8);
    opacity:1;}
  100% {transform:scale(1);
    opacity:0;}
}
<div class="pulse">
  <div class="button"> </div>
</div>

Answer №1

If you want to add a shadow effect, you can do it like this:

   .ripple{
  display: block;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border:2px red solid;
  animation: pulse 2s infinite;
}

@-webkit-keyframes pulse {
  0% {
    -webkit-box-shadow: 0 0 0 0 rgba(255,0,0, 0.4);
  }
  70% {
      -webkit-box-shadow: 0 0 0 10px rgba(255,0,0, 0);
  }
  100% {
      -webkit-box-shadow: 0 0 0 0 rgba(255,0,0, 0);
  }
}
   <div class="ripple"></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

CSS tooltip fails to display

I'm having trouble with my code as the tooltip is not showing up! Interestingly, when I tested the CSS on a static table, it worked perfectly. Essentially, the table in the code is dynamically created using information from an array for headers and d ...

When the browser size shrinks, turn off the drop-down navigation menu

I'm currently working on a responsive website, and I have encountered an issue with a dropdown menu. When the browser size is reduced to 900px, the menu shifts all the way to the left side. To address this, I added some left padding to keep it off the ...

What could be the reason for Express not retrieving my external CSS file?

The console consistently displays the message: GET http://localhost:8000/public/stylesheets/mystyle.css. Upon examining the image attached below, it is evident that this path is incorrect. I utilized WebStorm to create the href attribute for the CSS. app ...

Combining 2 divs harmoniously

I have a set of HTML div elements that are styled using the following CSS: div{ width:250px; height:250px; display:inline-block; border-radius: 10px; margin:10px; background:#2E2922; vertical-align:top; } In my HTML, these div ...

How to manage line breaks in React Native's text components

I have this text block: const line = "Hello\nworld"; Now I need to include it in a component like this: <Text numberOfLines={1} ellipsizeMode="tail" style={[styles.lastMessageText, { color: colors.backdrop }]} > ...

Identifying the moment when the body scroll reaches the top or bottom of an element

I have been experimenting with javascript and jquery to determine when the window scroll reaches the top of a specific element. Although I have been trying different methods, I have yet to see any successful outcomes: fiddle: https://jsfiddle.net/jzhang17 ...

Error message in JS and HTML is totally bizarre

My expertise in JavaScript is very limited, so the terms I use might not be entirely accurate. However, I'll do my best to explain the issue at hand. I'm facing a peculiar problem... I've been attempting to modify someone else's JS scr ...

Utilizing :checked selector and toggle() function in jQuery

I'm facing an issue with my jQuery code where the CSS changes are not working as expected. When I test the code, it doesn't apply the CSS changes. If I remove the :checked and just use $("input"), then the CSS works but only when clicking on an i ...

Shifting an icon to the left with CSS

.panel { margin-bottom: 20px; background-color: #F7FAFE; border: 1px solid transparent; border-radius: 4px; -webkit-box-shadow: 0 1px 1px rgba(0, 0, 0, .05); box-shadow: 0 1px 1px rgba(0, 0, 0, .05) } .panel-default { padding: 1 ...

Ensure that the label control is aligned to the left within the <div> element

I need assistance with aligning elements within my web page that contains some ASP.NET controls. Specifically, I am looking to align the Label control to the right within a div tag. Can someone provide guidance on how to achieve this alignment? Edit: Bel ...

Maximize the use of block level buttons on the navbar menu for small screens, while maintaining the regular size buttons when the menu is expanded in

Currently utilizing bootstrap 4 beta. In my navbar, standard sized buttons are used as nav-items when the screen is full-sized. These buttons align to the right of the navbar next to the site logo positioned on the left side of the navbar. https://i.ssta ...

Updating the hyperlink of an html element using css

I am looking to update this A tag <a href="contact.html" >Contact</a> to <a href="tel:+13174562564" >Contact</a> using only CSS, if possible. Alternatively, like this <a href="tel:+13174562564" >+13174562564</a> ...

applying flexbox for overlay with overflow effect

During the checkout process, I implemented an overlay on top of the website that disables scrolling on the body but allows overflow on the overlay. However, the content on the overlay gets clipped if the viewport is too small. How can this issue be preve ...

After my data rows are filled, I add jQuery and CSS striping animations to enhance their appearance

Before any click, they have this appearance: Clicking on Sales in the business section reveals a drop-down select box. If I click on "Sales" and modify the text area, it will transition to grey. While the grey rows change accordingly, the black rows shoul ...

Tips for displaying two HTML input elements side by side in a single row

This block of code HTML <input type="text" name="category" id="category" value="">&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" name="category_1" id="category_1" value="" tabindex="1"></div> Despite multiple attempts such ...

Fixed navbar stays at the top with body occupying 100% of the screen

In the process of developing a react app, I encountered an issue with a sticky top navbar from Bootstrap. After setting the body to height: 100%, the navbar no longer sticks as intended. I cannot use vh for one of my pages due to mobile content display i ...

Images of equal height without compromising the resolution

How can I create responsive images with the same height inside a DIV tag, with a specified height of 200px? Any assistance would be greatly appreciated. <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="desc ...

Is there a way to dynamically count the length of an element or class in realtime using JavaScript?

If there are currently 5 divs with the class name "item" and a new unknown number of divs with the same class name "item" are dynamically added in real time, I want my result to display the total number of divs present at that moment (i.e., 5 + n). Note: ...

JQuery hover functionality

What modifications are needed in the code below to display a div on the right side of the hyperlink when the onmouseover event occurs? <html> <head> <script src="http://code.jquery.com/jquery-latest.js"></script> <script> ...

Enhancing React Flow to provide updated selection and hover functionality

After diving into react flow, I found it to be quite user-friendly. However, I've hit a roadblock while attempting to update the styles of a selected node. My current workaround involves using useState to modify the style object for a specific Id. Is ...