-2

I have a video and a css animation, I want the video to be centred and the animation to the left. I tried floating them but this left a big gap in between them. - codepen - https://codepen.io/MarkHarrison/pen/xpZLLy

iframe{
    border: 10px solid transparent;
    border-image-source: url(https://i.imgur.com/91tJ1qi.png);
    border-image-slice: 10;
    width: 500px;
    height: 300px;
    display: block;
    margin: auto;
}

.box {
    position: relative;
    margin: 0px;
    display: block;
    width: 600px;
    height: 420px;
    margin-top: 15%;
}
julianstark999
  • 3,450
  • 1
  • 27
  • 41
Mark Harrison
  • 151
  • 1
  • 10

1 Answers1

0
  1. add "position: relative" to the .wrapper // don't 2. remove % margin-top from .box
  2. add magic css to .box

    position: absolute; top: 0; left: calc(50% - 520px); transform: translateX(-50%);

// dont' 4. adjust top with em/px so that the image fits vertically use transform: translateY() for that instead