What is the method for achieving a seamless rosace effect in CSS?

While working on my website, I added an interesting effect to a circle. Currently, the circle opens automatically when hovering the mouse over it and closes when the mouse moves away. However, I would like to modify it so that it automatically opens and closes without requiring any user interaction. Below is the CSS code for the circle:

HTML

<div class="circle">
   <h1>TRANCE-2014</h1>
</div>

CSS

    .circle {
      background: rgb(255, 255, 255);
      border-radius: 100%;
      cursor: pointer;
      position: relative;
      margin: 0 auto;
      width: 15em;
      height: 15em;
      overflow: hidden;
      -webkit-transform: translateZ(0);
      -moz-transform: translateZ(0);
      -ms-transform: translateZ(0);
      transform: translateZ(0);
  }
  .circle h1 {
      color: rgba(189, 185, 199, 0);
      font-family:'Lato', sans-serif;
      font-weight: 900;
      font-size: 1.6em;
      line-height: 8.2em;
      text-align: center;
      text-transform: uppercase;
      -webkit-font-smoothing: antialiased;
      -webkit-user-select: none;
      -moz-user-select: none;
      -ms-user-select: none;
      user-select: none;
      -webkit-transition: color 0.8s ease-in-out;
      -moz-transition: color 0.8s ease-in-out;
      -ms-transition: color 0.8s ease-in-out;
      transition: color 0.8s ease-in-out;
  }
  .circle:before, .circle:after {
      border-radius: 100%;
      content:"";
      position: absolute;
      top: 0;
      left: 0;
      width: inherit;
      height: inherit;
      box-shadow: inset 10.6em 0 0 rgba(30, 140, 209, 0.2), inset 0 10.6em 0 rgba(30, 140, 209, 0.2), inset -10.6em 0 0 rgba(30, 140, 209, 0.2), inset 0 -10.6em 0 rgba(30, 140, 209, 0.2);
      -webkit-transition: box-shadow 0.75s;
      -moz-transition: box-shadow 0.75s;
      -ms-transition: box-shadow 0.75s;
      transition: box-shadow 0.75s;
  }
  .circle:after {
      -webkit-transform: rotate(45deg);
      -moz-transform: rotate(45deg);
      transform: rotate(45deg);
  }
  .circle:hover:before, .circle:hover:after {
      box-shadow: inset 0.86em 0 0 rgba(255, 0, 0, 0.5), inset 0 0.86em 0 rgba(252, 150, 0, 0.5), inset -0.86em 0 0 rgba(0, 255, 0, 0.5), inset 0 -0.86em 0 rgba(0, 150, 255, 0.5);
  }
  .circle:hover > h1 {
      color: rgba(185, 185, 185, 1);
  }

Answer №1

Could you be referring to something similar to this demonstration?

If that's the case, you will need to utilize the @keyframes element of CSS. For more information, you can visit MDN or check out CSS-Tricks.

CSS

.circle {
    background: rgb(255, 255, 255);
    border-radius: 100%;
    cursor: pointer;
    position: relative;
    margin: 0 auto;
    width: 15em;
    height: 15em;
    overflow: hidden;
    -webkit-transform: translateZ(0);
    -moz-transform: translateZ(0);
    -ms-transform: translateZ(0);
    transform: translateZ(0);
}
.circle h1 {
    font-family:'Lato', sans-serif;
    font-weight: 900;
    font-size: 1.6em;
    line-height: 8.2em;
    text-align: center;
    text-transform: uppercase;
    -webkit-font-smoothing: antialiased;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-animation: showText 2s infinite; /* Safari/Chrome 4+ */
    -moz-animation: showText 2s infinite;    /* Firefox 5+ */
    -o-animation: showText 2s infinite;      /* Opera 12+ */     
    animation: showText 2s infinite;         /* IE 10+ */
    animation-timing-function: ease-in-out;

    /*
    ** -webkit-transition: color 0.8s ease-in-out;
    ** -moz-transition: color 0.8s ease-in-out;
    ** -ms-transition: color 0.8s ease-in-out;
    ** transition: color 0.8s ease-in-out;
    */
}
.circle:before, .circle:after {
    border-radius: 100%;
    content:"";
    position: absolute;
    top: 0;
    left: 0;
    width: inherit;
    height: inherit;
    -webkit-animation: moveCircle 2s infinite; /* Safari/Chrome 4+ */
    -moz-animation: moveCircle 2s infinite;    /* Firefox 5+ */
    -o-animation: moveCircle 2s infinite;      /* Opera 12+ */
    animation: moveCircle 2s infinite;         /* IE 10+ */

    /*
    ** -webkit-transition: box-shadow 0.75s;
    ** -moz-transition: box-shadow 0.75s;
    ** -ms-transition: box-shadow 0.75s;
    ** transition: box-shadow 0.75s;
    */
}
.circle:after {
    -webkit-transform: rotate(45deg);
    -moz-transform: rotate(45deg);
    transform: rotate(45deg);
}
@-webkit-keyframes moveCircle {
    0% {
        box-shadow: inset 10.6em 0 0 rgba(30, 140, 209, 0.2), inset 0 10.6em 0 rgba(30, 140, 209, 0.2), inset -10.6em 0 0 rgba(30, 140, 209, 0.2), inset 0 -10.6em 0 rgba(30, 140, 209, 0.2);
    }
    100% {
        box-shadow: inset 0.86em 0 0 rgba(255, 0, 0, 0.5), inset 0 0.86em 0 rgba(252, 150, 0, 0.5), inset -0.86em 0 0 rgba(0, 255, 0, 0.5), inset 0 -0.86em 0 rgba(0, 150, 255, 0.5);
    }
}
@-moz-keyframes moveCircle {
    0% {
        box-shadow: inset 10.6em 0 0 rgba(30, 140, 209, 0.2), inset 0 10.6em 0 rgba(30, 140, 209, 0.2), inset -10.6em 0 0 rgba(30, 140, 209, 0.2), inset 0 -10.6em 0 rgba(30, 140, 209, 0.2);
    }
    100% {
        box-shadow: inset 0.86em 0 0 rgba(255, 0, 0, 0.5), inset 0 0.86em 0 rgba(252, 150, 0, 0.5), inset -0.86em 0 0 rgba(0, 255, 0, 0.5), inset 0 -0.86em 0 rgba(0, 150, 255, 0.5);
    }
}
@-o-keyframes moveCircle {
    0% {
        box-shadow: inset 10.6em 0 0 rgba(30, 140, 209, 0.2), inset 0 10.6em 0 rgba(30, 140, 209, 0.2), inset -10.6em 0 0 rgba(30, 140, 209, 0.2), inset 0 -10.6em 0 rgba(30, 140, 209, 0.2);
    }
    100% {
        box-shadow: inset 0.86em 0 0 rgba(255, 0, 0, 0.5), inset 0 0.86em 0 rgba(252, 150, 0, 0.5), inset -0.86em 0 0 rgba(0, 255, 0, 0.5), inset 0 -0.86em 0 rgba(0, 150, 255, 0.5);
    }
}
@keyframes moveCircle {
    0% {
        box-shadow: inset 10.6em 0 0 rgba(30, 140, 209, 0.2), inset 0 10.6em 0 rgba(30, 140, 209, 0.2), inset -10.6em 0 0 rgba(30, 140, 209, 0.2), inset 0 -10.6em 0 rgba(30, 140, 209, 0.2);
    }
    100% {
        box-shadow: inset 0.86em 0 0 rgba(255, 0, 0, 0.5), inset 0 0.86em 0 rgba(252, 150, 0, 0.5), inset -0.86em 0 0 rgba(0, 255, 0, 0.5), inset 0 -0.86em 0 rgba(0, 150, 255, 0.5);
    }
}
@-webkit-keyframes showText {
    0% {
        color: rgba(189, 185, 199, 0);
    }
    100% {
        color: rgba(185, 185, 185, 1);
    }
}
@-moz-keyframes showText {
    0% {
        color: rgba(189, 185, 199, 0);
    }
    100% {
        color: rgba(185, 185, 185, 1);
    }
}
@-o-keyframes showText {
    0% {
        color: rgba(189, 185, 199, 0);
    }
    100% {
        color: rgba(185, 185, 185, 1);
    }
}
@keyframes showText {
    0% {
        color: rgba(189, 185, 199, 0);
    }
    100% {
        color: rgba(185, 185, 185, 1);
    }
}

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

Tips for showing a single table with buttons on display

I am using R markdown and have included multiple tables with buttons, but when I open the file, all tables are displayed at once. How can I ensure only one table is shown upon opening the file? <script type="text/javascript"> function sh ...

Ways to correct inverted text in live syntax highlighting using javascript

My coding script has a highlighting feature for keywords, but unfortunately, it is causing some unwanted effects like reversing and mixing up the text. I am seeking assistance to fix this issue, whether it be by un-reversing the text, moving the cursor to ...

Encountered a compiling error when attempting to watch for changes on the ./folder directory using the

An unexpected exception occurred: NullError: method 'length' not found on null File: /usr/local/lib/node_modules/sass/sass.dart.js Line: 8583:23 Function: tF.eA File: /usr/local/lib/node_modules/sass/sass.dart.js Line: 8585:28 Function: tF. ...

Closing the space between navigation bar choices

I'm currently working on my website's navbar menu and struggling to eliminate the gap between each of the navbar links. It seems that the li attributes with the class dropdown are slightly wider than the rest of the links, causing this issue. I&a ...

What are the steps to testing a webpage designed for Retina display?

I have designed a webpage optimized for retina display, but I don't own a monitor with that capability. Is there a simulation tool available to test websites on retina displays? Alternatively, are there non-Apple monitors comparable to Apple's ...

How can I design an avatar image within a button similar to Facebook's style?

I'm currently working on a project that involves adding an avatar and a dropdown menu for account settings to my navigation bar. I've already created the dropdown, but I'm having trouble styling the avatar within the button. The button is ta ...

Error! D3.js is throwing an Uncaught TypeError because it cannot find the function .enter(...).append(...).merge

Currently, I am facing an issue while attempting to construct a table with multiple nested dropdowns using d3.js. The problem arises when switching from a newer version of d3 where my code functions flawlessly to d3.js v3. Upon replacing the newer version ...

How can I assign a class to my Typography component in Material UI?

When using my material-ui component, I wanted to add an ellipsis to my Typography element when it overflows. To achieve this, I defined the following styles: const customStyles = (theme) => ({ root: { textAlign: "left", margin: theme.spacing( ...

Button located beneath or above each individual image within the *ngFor loop

With the *ngFor loop, I am able to populate images but now I want to include a button below or on each image. Unfortunately, my CSS knowledge is limited. Below is the code I have: HTML Code <div class="container"> <div ...

Adjusting my menu layout causes my header image to be partially covered

I've been trying to make my menu fixed at the top of my website, but it keeps overlapping into my header image and doesn't look right. I've experimented with different solutions, but nothing seems to work. Here's the CSS code I used th ...

When Css is incorporated within a text, it prevents the use of " " from functioning properly

I am currently developing a GUI application using Qt 4.8. I have a label that displays text in white (the stylesheet has already been set up for this) and I want to change the color of the word "UPDATE" to red. Here is my initial code: //all text in whit ...

Is the script failing to retrieve the innerHTML content?

Here is a snippet of HTML code: <div id="team_players"> <h3>Players</h3> <button class="bold-btn" onclick="teamAct('player_list');">Refresh List ↻</button> <table> <thead> <tr> ...

Scale transformation - I am aiming for it to exceed the limits, yet it remains contained within

Currently, I am working on enhancing my carousel by implementing a zoom effect when hovering over the images. However, I have encountered an issue where the image gets hidden within the div container and doesn't overflow as expected. I tried adjusting ...

The functionality to open the menu by clicking is experiencing issues

I'm attempting to replicate the Apple website layout. HTML structure: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" conte ...

Combining D3.js tooltip positioning with CSS overflow styling

I am encountering an issue with displaying tooltips in D3 when combined with CSS overflow. Is there a solution available for this particular problem? CSS code: #chart1 { overflow-x: auto; overflow-y: hidden; max-width: 800px; max-height: 22 ...

When scrolling down, the popup window shifts its position

I have implemented a popup window which displays a list on hover. It works perfectly on the default page, but when I scroll down, the popup also moves with the scrollbar. Below is the HTML code that creates the hidden popup list initially and shows it on ...

Discover the step-by-step guide to implementing pagination using NG-ZORRO-Andt in your Angular

I am currently using NG-ZORRO Ant Design pagination on my HTML page and it is displaying correctly in my browser. However, I am struggling with linking the data from the API to the pagination feature. Here is the snippet of my HTML code: <div class ...

Is it possible to create an HTML select that displays transparent text after a selection

I'm currently working on customizing the appearance of an HTML select element with various background color options. Everything is functioning properly, but I have a specific requirement. I want the text in the dropdown options to be visible only when ...

Changing the background color of a child in GTK3 using CSS in C language

Looking for help with setting the background of all 4 child elements in my App. I'm a bit lost on how to do it. Here is an Example of what the App looks like: I want to change the backgrounds as follows: One - Red Two - Yellow Three - Green Fo ...

Tips for retrieving a selected date from an HTML textbox labeled as "Date"

My goal was to find the differences between two dates by utilizing an HTML Date textbox. <input type="text" name="datein" id="datein" value="" class="inputtexbox datepicker" style="display: none" is-Date/> <input type="text" name="dateto" id=" ...