Overlapping an animated logo with a Static one?

demo on GitHubPages @ CRUDgames.com
repo

I’ve made a circular.png and have used it to replace the spinning logo in Create React App. Then right below it a static cut out of a hammer, that should just stay stationary while the wording spins around it. My question is what CSS should I be trying to use to make sure they always line up. I know about the z index, but should I be trying float, center, clear? Absolute positioning feels counterproductive on a responsive design

App.js

import logo from './ScriptHammerCom.png';
import hammer from './Wooden-hammer-01.png';
import './App.css';

function App() {
  return (
    <div className="App">
      <header className="App-header">
        <img src={logo} className="App-logo" alt="logo" />
        <img src={hammer} className="App-hammer" alt="wooden mallet" />
      </header>
    </div>
  );
}

export default App;

App.css

.App {
  text-align: center;
}

.App-logo {
  height: 40vmin;
  pointer-events: none;
}

@media (prefers-reduced-motion: no-preference) {
  .App-logo {
    animation: App-logo-spin infinite 20s linear;
  }
}

.App-hammer {
  height: 40vmin;
  pointer-events: none;
}

.App-header {
  background-color: #282c34;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: calc(10px + 2vmin);
  color: white;
}

.App-link {
  color: #61dafb;
}

@keyframes App-logo-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

Hi there TurtleWolf1,

here’s an example for you to try…

Full Page View:-

https://codepen.io/coothead/full/WNGoPaQ

Editor View:-

https://codepen.io/coothead/pen/WNGoPaQ

coothead

1 Like

That’s Perfect!
thank you so much!

No problem, you’re very welcome. :winky:

coothead

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.