J
J
John_Smith2282021-08-01 18:34:39
css
John_Smith228, 2021-08-01 18:34:39

How to center an element in CSS?

Circle and play button separate images. I tried to do something, but it doesn't work very well.

<div class="content__video2">
    <div class="container">
      <div class="video__inner">
        <div class="circle">

        <img src="img/circle.png">

          
        <img src="img/play.png" class="play">

        
        </div>
      </div>
    </div>
  </div>


.content__video2 {
  display: flex;
  height: 550px;

  background: url(img/2video_bc.jpg) center no-repeat;
  background-size: cover;	
  width: 100%; 
  position: absolute;
  top: 1072px; left: 0px;
  z-index: 100;
  opacity: .85;
  flex-direction: column;
}

.video__inner {
  width: 100%; 
  padding: 202px; 
  text-align: center;
}

.circle {
  display: block;
  position: relative;
  width: 100%;
  
  margin: 0 auto;
}

.play {
  display: block;
  position: absolute;
  top: 28px; left: 252px;
  
}


6106bf59704e5998848572.png

Please do not scold me for the compiled code, I'm just learning))

Answer the question

In order to leave comments, you need to log in

4 answer(s)
A
Andrey Fedorov, 2021-08-01
@aliencash

https://codepen.io/aliencash/pen/bGWKoyq

Z
ZerdoX-x, 2021-08-01
@ZerdoX-x

If you are learning, then I advise you to study this article: https://css-tricks.com/centering-css-complete-guide/
Asking on similar services and copying the code, you will move slowly :)

S
Sanyok R, 2021-08-02
@sanyokdb

here is another example
https://codepen.io/sanyokdb/pen/GRJbzgE

A
Alexander Nesterov, 2021-08-01
@AlexNest

Something like this?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question