I have a div that is positioned absolutely and I gave it a left
position.
For desktop it is necessary to have the left
position of 100px.
But for tablet I want to push it all the way to the right.
To achieve this I tried doing right: 0
, but since left: 100px
is already defined in the CSS, the right: 0
does not push it all the way to the right as intended.
Then I tried doing left: 0
in tablet to cancel out the effect that it has but that didn't work either.
Is there a way to cancel out the left
position? Something like left: none
(I know that does not work but it's the only way I am able to explain this.)
Desktop CSS:
.mydiv {
positon: absolute;
left: 100px;
}
Tablet CSS:
@media (max-width:768px){
.mydiv {
left: 0;
right: 0;
}
}
I could do something like right: 400px
to get it to the position that I want but I am just curious if there is a way where I can use right: 0
so I know for sure that it is pushed totally to the right.
Thanks!