Tips on switching the direction of the ripple effect on this button code from left to right

Link to button Code

Hi there, I'm not very familiar with CSS. Can someone help me create a ripple effect on this button that starts from the right side and moves towards the left? Basically, I want to change the direction of the ripple effect.

.button {
  position: relative;
  background-color: #04AA6D;
  border: none;
  font-size: 28px;
  color: #FFFFFF;
  padding: 20px;
  width: 200px;
  text-align: center;
  -webkit-transition-duration: 0.4s; /* Safari */
  transition-duration: 0.4s;
  text-decoration: none;
  overflow: hidden;
  cursor: pointer;
}

.button:after {
  content: "";
  background: #90EE90;
  display: block;
  position: absolute;
  padding-top: 300%;
  padding-left: 350%;
  margin-left: -20px!important;
  margin-top: -120%;
  opacity: 0;
  transition: all 0.8s
}

.button:active:after {
  padding: 0;
  margin: 0;
  opacity: 1;
  transition: 0s
}

Answer №1

To initiate the ripple effect from the right side, you can simply include right: 0; in ".button:after". Here is an example that has been tested and proven to work:

.button {
  position: relative;
  background-color: #04AA6D;
  border: none;
  font-size: 28px;
  color: #FFFFFF;
  padding: 20px;
  width: 200px;
  text-align: center;
  -webkit-transition-duration: 0.4s;
  /* Safari */
  transition-duration: 0.4s;
  text-decoration: none;
  overflow: hidden;
  cursor: pointer;
}

.button:after {
  content: "";
  background: #90EE90;
  display: block;
  right: 0; /* New code */
  position: absolute;
  padding-top: 300%;
  padding-right: 350%;
  margin-left: -20px!important;
  margin-top: -120%;
  opacity: 0;
  transition: all 0.8s
}

.button:active:after {
  padding: 0;
  margin: 0;
  opacity: 1;
  transition: 0s
}
<button class="button">Click me</a>

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

Are there any potential drawbacks to utilizing fabricated attributes in HTML tags?

Imagine I have this HTML tag <a href=""></a> and then I decide to create a custom attribute <a lol="haha" href=""></a> Why would I do this? Well, it's so I can easily utilize that custom attribut ...

Is a Text-Only View Possible with WebView?

Could someone help me figure out how to restrict a WebView to only load text in my WinRT XAML App? I am looking for a simpler solution than having to download the source and manually editing img tags. ...

Show an HTML email message on a webpage without disrupting the existing page layout

Looking for a solution to display mail messages on a web page originating from an exchange server with various style elements that might interfere with the existing page layout. Attempting to load these mail messages within a div results in the style elem ...

Ways to implement a personalized button in place of jquery ui buttons

Is there a way to replace the standard jQuery dialog buttons with custom images? I have created new buttons in Photoshop with a .png extension and would like to use them instead of the default dialog buttons. I think this can be done through CSS, but if y ...

organizing the div based on the given data

I'm working on developing a web application using HTML and AngularJS. There are two main div elements: Div 1 <div class="box1" style="margin-top:20px;"> <span ng-repeat="i in data" style="font-size:14px; font-weight:normal">{{i.div ...

variable containing a combination of left-to-right and right-to-left characters

I am working on a piece of text which contains Hebrew (rtl) and English (ltr) letters. It is a song with chords placed above the words. The issue I am facing has to do with the chords - because the site is rtl, the chords appear messy. Is there a way to h ...

What is the reason .navbar-dark is not functioning in Bootstrap v5.2?

I am puzzled by the fact that navbar-dark is not changing the text color in the nav. I'm not sure why this is happening. Any insights would be greatly appreciated! <!doctype html> <html lang="en"> <head> <meta charset=" ...

Secure your DOM's href attribute from prying eyes

I have a display page that shows all of our reports in the following format: https://i.sstatic.net/lNzH8.png When hovering over a report, it displays the file's URL (where it is located on our server). I want to prevent users from accessing this inf ...

How to create a vibrant and colourful full background

How can I make the background color fill the entire width of the page? I am new to HTML and CSS, so below is the code I have used for setting the background. Please provide clear instructions on what changes I need to make in my code to achieve this. I kno ...

Tips for customizing a dropdown menu where the first item is not the label and may include an input field

How can I create a dropdown box that includes a label of "select so and so..." and when the user clicks on it, a list of options is displayed with the first option being blank instead of showing the label name? Is it possible to include an input box insi ...

I am looking to input and store the Kannada text used in my Angular project

I am facing an issue with my html form where I call an API to save text fields in a database. The problem arises when I type Kannada words in the text field, as when rendering the list, the Kannada fonts are displayed as ??. I am seeking a solution to thi ...

Tips for locating the index of the previously selected active class

I am currently working on a slider and have made progress up to this point. However, I am facing an issue where I cannot proceed because I need to identify the index of the item from which I removed the last active class before the click event occurs. My ...

What causes the lack of impact when editing bootstrap.css files in an ASP.NET Core Web App?

As I dive into ASP.NET, I decided to start by creating a default Web App template in Visual Studio. To my surprise, despite having bootstrap.css files in the wwwroot folder, any changes I make to them seem to have no effect on the website's appearance ...

Ways to recognize when a button has been pressed

I developed my website using the CodeIgniter framework. Here is my personal website On the homepage, if I click on the "landscape" picture (top right) or the "landscape" button in the menu, it takes me to the "landscape" page. However, when I return to t ...

"When implementing an Ajax autorefresh feature, ensure you pass the necessary variables consistently to update the content. Don't overlook

My chat box consists of two frames... The first frame displays all the usernames, while the second frame shows the full chat when a user is clicked from the first frame. I need to reload the second frame every time to check for new messages from the send ...

Element remains hidden until the developer console is activated

On my website, I've noticed that certain LayerSlider elements are remaining invisible until: The window is resized I disable the Bookmarks bar in Chrome (quite strange, right?) I switch on the Chrome debugger tools This issue is not exclusive to Ch ...

Is there a way to successfully press a button on a website?

While testing, I start by navigating in the constructor webBrowser1.ScriptErrorsSuppressed = true; webBrowser1.Navigate("http://www.tapuz.co.il/forums/forumpage/393"); webBrowser1.DocumentCompleted += webBrowser1_DocumentCompleted; Next, in the DocumentC ...

The checkbox filter in Angular 6 has the ability to replace the previously selected

I've been working on creating a filter system using checkboxes. Below is a snippet of the code I'm currently using: filter.pipe.ts import { Pipe, PipeTransform, Injectable } from '@angular/core'; @Pipe({ name: 'filter2' }) ...

Delete the designated column from the table

I am having difficulty with hiding and showing table columns using checkboxes. I need to eliminate the Mars column (in bold) along with its corresponding data (also in bold). Once the Mars column is removed, I want the Venus column and its data values to ...

Position the image on the right side of several lines of text

My webpage contains two div elements: one for displaying multi-line text and the other for showing an image which is positioned to the right of the text. The width of the image is not fixed and can be adjusted using a user-defined parameter. <div> ...