'Can i use margin auto, and left with transform at the same time?
At a webpage i observed that there is a problem with positioning, so i started remove some css to see what is a problem. The problem is that navbar has 1px on the left from the edge of screen. To be honest i dont now what is deeper level of this. When i remove last two lines everything looks ok so my question is:
can i use margin auto, and left with transform at the same time?
.navbar {
background-color: rgba(0, 0, 0, 0.85) !important;
position: fixed;
top: 0px;
width: 100%;
height: 50px;
z-index: 1051;
max-width: 1920px;
margin: auto;
left: 50%;
transform: translateX(-50%);
}
Solution 1:[1]
Yes, you can. However, the margin won't do anything, since your position is fixed. The last two lines just center the navbar, which will have no visual effect until your screen is wider than 1920px and the max-width kicks in.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | bowlowl |
