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

The background color and border are not showing up in the <div> element

I am encountering an issue with 3 inline <div> elements where the one on the far left is not displaying the light blue background and black border that it should have. HTML: <!DOCTYPE html> </html> <head> <link rel= ...

Challenges with conflicting CSS styling issues

I am facing a CSS issue on my website. I am trying to add captions for images on my site. I have experimented with the jquery-capty plugin () and some custom CSS styles for framed images (). While both solutions work in my regular layout, they do not funct ...

Adjusting the input label to be aligned inside the input box and positioned to the right side

I am currently working on aligning my input label inside the input box and positioning it to float right. The input boxes I am using have been extended from b4. Currently, this is how it appears (see arrow for desired alignment): https://i.stack.imgur.co ...

Incorporating a delete button onto an image using JavaScript

I am currently developing a BlogApp and facing difficulty in attempting to include a button on an image. The image is being retrieved from the Django database in JavaScript (HTML). My goal is to have a clickable button overlaid on the image. views.py def ...

A guide on dynamically adjusting text size based on viewport width and height in React with TailwindCSS

Utilizing React and Tailwind, I am working towards creating two overlapping rectangles with text. The top rectangle's text should be aligned to the left, while the bottom rectangle's text should be aligned to the right. Regardless of window size ...

How can JavaScript be used to deactivate an HTML form element?

Within this form, there are two selection buttons that require client-side validation. The user must choose one of them, and once a selection is made, the other button should automatically be disabled. Below is the script I have implemented: <html> ...

Glistening: A variety of designs for textInputs and selectInputs

I am working on styling 2 textInput and 2 selectInput functions, one on a dark background sidebar and the other inside a white bsModal. I want to style them differently. Is there a way to keep the sidebar elements styled one way and change the font and bor ...

Why is my bootstrap-enhanced website appearing unattractive on MSIE 8?

Check out my website at My website displays perfectly in browsers like Firefox, Chrome, Opera, and the Android Browser. However, when I viewed it on Internet Explorer 8 at my parent's house, it looked all messed up. How can I improve the compatibilit ...

Angular error: Unable to access the 'toLowerCase' property of an undefined value

I've been working on creating my own custom filter pipe by following the instructions in this video tutorial, but I encountered an error message stating, "Angular, TypeError: Cannot read property 'toLowerCase' of undefined". I have already i ...

Does CSS positioning change depending on the screen size?

I need help fixing the positioning of my logo on the screen. I want it to be 40px from the top and centered horizontally regardless of the screen size. Here is the code that I have: <html> <head> <style type="text/css> body{ back ...

What is the proper way to display the initial content of the menu?

I am currently working on a website design for an upcoming festival. The festival spans over three days, so I have created buttons to navigate and load the content for each day separately. Is there a way for me to make the content for the first day di ...

How can you assign a value to an HTML Input by dragging an SVG shape or canvas?

I am currently in the process of creating a user interface for setting pricing parameters. There are three categories that need to be visually represented, along with two sliders to determine suggested Buy/Sell prices. To demonstrate my progress so far, I ...

What is the method for creating a HTML test report using Python incorporated into my code?

from selenium import webdriver import unittest, time, re import HTMLTestRunner class TestAutomation(unittest.TestCase): def setUp(self): self.errors = [] self.driver = webdriver.Chrome() self.driver.get("http: ...

Discovering data in individual tr elements within a table with jQuery by utilizing .text()

I'm currently working on a project where I need to separate the three table rows within a dynamically generated table. My goal is to have jQuery treat each row individually in order to extract specific values like price and SKU. You can see an example ...

How do you position items in the center and lower right corner of a flexbox that takes up the entire

One feature on my website is a flex box that takes up the entire window with a width of 100% and a height of 100vh. Within this flex box, I've centered text and a button, but now I'd like to add a footer to the page. If I simply place the footer ...

deactivating image mapping on mobile media screens

I'm looking to disable my image map on mobile screens using media queries. I've attempted to include some javascript in the head of my html file, but I encountered an error: <script src="http://code.jquery.com/jquery-1.11.3.min.js"></s ...

Looking for advice on using media queries to resize my background image - any tips?

I'm struggling to resize my background image using media queries. Can anyone offer suggestions or solutions? I've tried applying the media query for my background image like I do with other elements, and it's not working properly. The issue ...

Utilizing Vue CLI plugin to dynamically pass JS variables as props

I am currently using version 4.5 of the Vue CLI plugin. I have created a component that takes in a title as a prop. This component has been converted into a web component and added to an HTML webpage (which is not a Vue JS project) Now, I am attempting to ...

Storing information when an object is indexed in a for loop, to be retrieved later when

My JavaScript code includes an AJAX call that takes user input from a form and uses it to search for a JSON object. The matching objects are then displayed in a datalist successfully. Everything is working well so far, but now I want to extract specific f ...

What is the best way to ensure that all elements inside a Grid item extend to the bottom, except for the text?

I currently have four columns within a Grid container, each structured as follows: <Grid item> <Typography>Big Title 1</Typography> <Card className={classes.stretchMe}> <CardContent> ...