supergiox
supergiox

Reputation: 1596

Fixed margin at the bottom of the page

I've a page with a main scrollable div like this:

<html>
<head>
<style type="text/css">
  #mydiv{
  overflow: auto;
  width: 300px;
  }
</style>
</head>
<body>
  <div id="mydiv">content</div>
</body>
</html>

How can I have a fixed margin (for example 30px) at the bottom of the page? The div can have a small or big height (depending on the screen size), but the margin should be fixed. Thanks in advice

Upvotes: 0

Views: 1657

Answers (2)

Shailender Arora
Shailender Arora

Reputation: 7778

you can simply define the margin-bottom in your css like this :-

#mydiv{ overflow: auto; width: 300px; border:1px solid red; margin-bottom:30px; }

or see the demo :-http://jsfiddle.net/XxuvE/4/

Upvotes: 1

Robert
Robert

Reputation: 3074

You can create another div either inside your existing or outside depending on how you want your page to layout. Then apply this style to the div #myftr { margin: 30px; }

Something like this.

http://jsfiddle.net/rhoenig/XxuvE/

Upvotes: 1

Related Questions