/    Sign up×
Community /Pin to ProfileBookmark

Arranging DIVs

I am trying to center three DIVs on a page but I need each div to be able to automatically resize itself vertically to accommodate the amount of content it holds (which will change). Every time I try to float them, the parent container (the one centering them) will stop holding them.

(Refer to attached file for clarification)

Any help would be appreciated.

[upl-file uuid=f9a91b8d-8488-4b70-a258-b4d1006d6e2b size=50kB]example.bmp[/upl-file]

to post a comment
CSS

4 Comments(s)

Copy linkTweet thisAlerts:
@chadstenJul 07.2008 — I am trying to center three DIVs on a page but I need each div to be able to automatically resize itself vertically to accommodate the amount of content it holds (which will change). Every time I try to float them, the parent container (the one centering them) will stop holding them.

(Refer to attached file for clarification)

Any help would be appreciated.[/QUOTE]


I am sure I can help, but I am gonna need source code...
Copy linkTweet thisAlerts:
@chadstenJul 07.2008 — HTML:
[code=html]<div id="pageWrapper">
<div id="leftColumn">
<div id="whateverContainer"></div>
</div>
<div id="middleColumn">
<div id="whateverOtherContainerOne"></div>
<div id="whateverOtherContainerTwo"></div>
</div>
<div id="rightColumn">
<div id="YouGetTheIdea"></div>
</div>
<div id="anythingBelow"></div>
</div>
[/code]


and here is the CSS

[CODE]body {
background-color:#fffff7;
text-align:center;
}
#pageWrapper {
width:960px;
margin:0pt auto;
position:relative;
text-align:left;
background-color:#fffff7;
}

#leftColumn, #middleColumn {
float:left;
width:315px;
}

#rightColumn {
float:right;
width:315px;
}

#anythingBelow {
clear:both;

}[/CODE]


Ok, that was some like 2 minute hand coding....but you should get the idea...
Copy linkTweet thisAlerts:
@Declan1991Jul 07.2008 — EDIT: Said what chadsten did.
Copy linkTweet thisAlerts:
@meinslaauthorJul 07.2008 — Fantastic. Thanks for your help, chadsten.
×

Success!

Help @meinsla 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.17,
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: @nearjob,
tipped: article
amount: 1000 SATS,

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

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