Reputation: 35
I want to make a div which is fixed on the bottom and right but top margin and left margin will always be 100px from the browser! It is very weird I know but I coulndt do it. Maybe it needs a javascript? or can I make it with css?
Upvotes: 3
Views: 69
Reputation: 191819
Media queries. Learn to use and love them.
@media all and (max-width: 600px) {
div {
left: 0;
margin-left: 100px;
}
}
@media all and (max-height: 300px) {
div {
top: 0;
margin-top: 100px;
}
}
Upvotes: 1
Reputation: 50269
Here is a solution, just set left
and top
to the margin you need.
JS
<div class="fixed"></div>
CSS
.fixed {
position:fixed;
left:100px;
top:100px;
right:0;
bottom:0;
background-color:#F00;
}
Upvotes: 2