Is it possible with css' absolute positioning element to do something like:
.myElement{
width: 385px;
position: absolute;
left: 50% - 385px;
}
and have the element offset by a percentage minus its width, or something similar?
use a negative margin in the direction you want to go.
.myElement{
width: 385px;
position: absolute;
left: 50%;
margin-left: -385px;
}
you can also use calc:
.myElement{
width: 385px;
position: absolute;
left: **calc(50% - 385px)**;}
it's pretty much supported-> http://caniuse.com/#feat=calc
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With