Hello,
I centralised always an absolute object or group of a menu (.navbar > .container) on rainbow object (.navbar-fundo) in a relative object (nav), using left: calc(), but in other screens resolutions of computers, tablets and big mobiles, it is not always centralised.
nav
{
position: relative;
overflow: hidden !important;
}
.navbar-fundo
{
background: repeating-linear-gradient(-45deg, hotpink, red, orange, yellow, green, turquoise, indigo, violet);
background-size: cover;
filter: blur(20px);
opacity: 0.5;
transform: scale(1.3);
height: 44px;
width: 100%;
}
.navbar > .container
{
position: absolute;
left: -webkit-calc(100% - 70%);
left: -moz-calc(100% - 70%);
left: calc(100% - 70%);
}
You can check JSFiddle: jsfiddle.net/gusbemacbe/jc9qdz26/9
King Bee
I Vue, you Vue, we all Vue
Hmmm... If you want something to always be centralized, I suggest using flexbox and grid instead. Then you don't have to bother with absolute values either.
In flexbox, for instance, you can just:
display: flex; align-items: center; justify-content: center;or something like that. It's just as simple using grid, too!