Click here to Skip to main content
15,885,309 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm currently designing QR code scanner with a box but it's not getting center

What I have tried:

.element{
                                  align-self: center;
                                  display: block;
                                  position:justify;
                                  
                                  margin-left: 100px;
                                  margin-right: auto;
                                
                            
                                 
                                  top:0px;
                                  width:500px;
                                  height:310px;
                                  background:rgba(0,0,0,0.5) ;
                                  -webkit-clip-path: polygon(0% 0%, 0% 100%, 25% 100%, 25% 25%, 75% 25%, 75% 75%, 25% 75%, 25% 100%, 100% 100%, 100% 0%);
                                  clip-path: polygon(0% 0%, 0% 100%, 25% 100%, 25% 25%, 75% 25%, 75% 75%, 25% 75%, 25% 100%, 100% 100%, 100% 0%);
                                  
                                }
Posted
Updated 25-Feb-22 1:09am

1 solution

There are many different ways to do what you want. align-self requires the element to be inside of a grid or flexbox element parent - ref: align-self - CSS: Cascading Style Sheets | MDN[^]

Here is a video that will show you one what how to: The fastest way to center vertically & horizontally with CSS - YouTube[^]

The reason why I posted the video is that Kevin is an Expert with many videos that will answer other questions for you beyond the one above.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900