/    Sign up×
Community /Pin to ProfileBookmark

Space after div

Hi all,

I’m programming a lay-out with css. The lay-out contains a contentbox which has position: absolute. When I put lots of text into the contentbox, the box reaches the edge of the page. How can I add space at the bottom of the box so that there is a space between the bottom of the page and the contentbox? I tried margin-bottom: 40px but it didn’t work for me.

Please help!

to post a comment
CSS

3 Comments(s)

Copy linkTweet thisAlerts:
@letmehaveagoSep 18.2010 — position: absolute elements are taken out of the flow. This means it is basically independent to other elements except for the parent with position: relative. That is if you use margin on an position: absolute element it is in relation to the parent.

I think the only way to fix what you have described without Javascript is not to use position: absolute;
Copy linkTweet thisAlerts:
@nyxSep 25.2010 — Could you not have a relatively positioned div around the content, inside of the abolutely positioned element and add the margin to this?
Copy linkTweet thisAlerts:
@eagle1983Sep 26.2010 — nice suggestions.
×

Success!

Help @iRolf spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.2,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,
)...