/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] CSS Layout Issue

Hi,

I’m trying to create a two column CSS layout framework.

The two columns must be vertically and horizontal centred dependant on screen resolution, with column 2 horizontally fluid. Also, column 2 must be scrollable.

Any help or ideas welcome.

Thank you,

Barton.

to post a comment
CSS

12 Comments(s)

Copy linkTweet thisAlerts:
@Declan1991Apr 08.2008 — You're a bit vague. Do you want them both with space to either side etc. A graphic, maybe, of what you would like?
Copy linkTweet thisAlerts:
@WebJoelApr 08.2008 — "...[I]trying to create[/I].." -Can you post the code that you have so far, so we can work on it?
Copy linkTweet thisAlerts:
@Barton68authorApr 08.2008 — Hi,

no problem...

Layout Design

Thanks again for any help,

Barton
Copy linkTweet thisAlerts:
@Barton68authorApr 08.2008 — I've deleted the whole lot because it was rubbish and frustrated me so much.

?
Copy linkTweet thisAlerts:
@WebJoelApr 09.2008 — You posted an image, -not code, -but that is okay too because that tells me alot. This particular layout is fairly simple. I will try to write-up a mock for this tomorrow sometime, and post it back.
Copy linkTweet thisAlerts:
@Barton68authorApr 09.2008 — Thank so much, been trying for almost a week.

I've tried divs, tables, and frames. All seem to work until I confirm in BrowserShots... ?
Copy linkTweet thisAlerts:
@HydroApr 09.2008 — You should look at creating an overall div that you apply a style to so that it is centered:
<i>
</i>#overallDiv{
margin: 0 auto;
width: 700px;
height: 500px;
}


then place your other divs inside, eg:

<i>
</i>&lt;div id="overallDiv"&gt;
&lt;div id="menuDiv"&gt;&lt;/div&gt;
&lt;div id="contentDiv"&gt;&lt;/div&gt;
&lt;/div&gt;
Copy linkTweet thisAlerts:
@SiddanApr 09.2008 — I have found this after a simple search on google which you were after.

The code is very basic and allows you to freely customise it with ease

http://astralshapes.com/fluid/2%20columns/2colhfrs/index.html

study it till at least WebJoel has come up with something :p
Copy linkTweet thisAlerts:
@Barton68authorApr 11.2008 — Many thanks, ideal....
Copy linkTweet thisAlerts:
@WebJoelApr 11.2008 — ah yes, -I *lost this thread* and couldn't find it... (& got busy with some client stuff that came up)..

I'll work on this today. ?
Copy linkTweet thisAlerts:
@WebJoelApr 12.2008 — [I]And I forgot, -again[/I]! ?

I whipped-up a quickie example just now that I think does what you want. See if this is any good for you.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<meta http-equiv="Content-Style-Type" content="text/css" />

<meta http-equiv="Content-Script-Type" content="text/javascript" />

<title></title>

<style type="text/css">

* {border:0; padding:0; margin:0;}/* Set everything to "zero" */

html, body {min-height:100%; /*for compliant browsers*/ height:100%;

font:x-small Arial, Verdana, sans-serif; voice-family: ""}"";voice-family:inherit;font-size:small;/*for IE 5.5 */

font-size:100%; line-height:1.125em;}

body {background-color:#e1ddd9; font-size:12px; font-family:Arial, verdana, helvetica, georgia, times new roman, times, sans-serif;

color:#564b47; padding-bottom:25px; /* IE does not understand "margin-bottom" on BODY, so padding-bottom instead*/}

ul li {float:left; /* cure IE5.x "whitespace in lists" problem */width: 100%;}

ul li a {height:1%; /* make links honour display:block properly */}

#wrapper {position:relative; width:85%; margin:30px auto 3px auto; background-color:#fff; height:400px; margin-bottom:-3px;}

#wrapper p {margin:10px; color:black; background-color:transparent}

* html #content {height:100%;}/* and feed older IE what it needs */

#header {width:100%; height:75px; border-bottom:3px double gray;}

#navs {position:absolute; left:0; top:80px; margin:10px; width:160px; padding:20px 0; height:273px; background-color:wheat;}

#navs li {margin:15px 0 5px 10px; list-style-type:none;}

#navs li a {}

#navs li a:hover{color:red; padding-left:5px;}

#text {margin-left:180px; border-left:3px double gray; height:270px; background-color:silver; padding:25px 20px 30px 25px; overflow-y:scroll; }

#footer {width:85%; height:20px; padding:20px 0; margin:0 auto; background-color:tan; border-top:17px solid white; text-align:center;}

html, body, p, th, td, li, dd, dt {font:0.875em Arial, Helvetica, verdana sans-serif;}

h1, h2, h3, h4, h5, h6 {font-family:Arial, Helvetica, 'times new roman', serif; margin:10px}

h1 {font-size:2.0em;}

h2 {font-size:1.5em;}

h3 {font-size:1.2em;}

h4 {font-size:1.0em;}

h5 {font-size:0.9em;}

h6 {font-size:0.8em;}/* Defined default Header sizes*/

a:link, a:visited, a:focus, a:hover, a:active {background-color:none;}/*s.508 Accessibility*/

a:link {color:#00f;}

a:visited {color:#009;}

a:focus, a:hover {color:#06f;}/* a:focus for non-mouse pointers: e.g. "hotkeys", etc. s.508*/

a:active {color:#0cf;}

<!--[if lte IE 6]-->

body {font-size:17px;}/*for IE*/

<!--<[endif]-->

</style>

<!--[if lt IE 8]>

<script src="http://ie7-js.googlecode.com/svn/version/2.0(beta3)/IE8.js" type="text/javascript"></script>

<![endif]-->

<script type="text/javascript"><!--

// -->

</script>

<link rel="shortcut icon" href="favicon.ico" /><!-- path to your favicon -->

</head>

<body>

<div id="wrapper">

<div id="header">

<h1>Header stuff</h1>

</div>

<ul id="navs">

<li><a href="#">Link here</a></li>

<li><a href="#">Link here</a></li>

<li><a href="#">Link here</a></li>

<li><a href="#">Link here</a></li>

</ul>

<div id="text">

<h1>Text Goes Here</h1>

<p>But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and

I will give you a complete account of the system, and expound the actual teachings of the great explorer of

the truth, the master-builder of human happiness.</p>

<p>No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how

to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who

loves or pursues or desires to obtain pain of itself, because it is pain, but because occasionally circumstances

occur in which toil and pain can procure him some great pleasure.</p>

<p>To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some

advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that

has no annoying consequences, or one who avoids a pain that produces no resultant pleasure?</p>

<p>On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized

by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that

are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is

the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish.</p>

<p>In a free hour, when our power of choice is untrammelled and when nothing prevents our being able to do what we like best,

every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty

or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted.

The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure

other greater pleasures, or else he endures pains to avoid worse pains.

</p>

<h1>Text Goes Here</h1>

<p>But I must explain to you how all this mistaken idea of denouncing pleasure and praising pain was born and

I will give you a complete account of the system, and expound the actual teachings of the great explorer of

the truth, the master-builder of human happiness.</p>

<p>No one rejects, dislikes, or avoids pleasure itself, because it is pleasure, but because those who do not know how

to pursue pleasure rationally encounter consequences that are extremely painful. Nor again is there anyone who

loves or pursues or desires to obtain pain of itself, because it is pain, but because occasionally circumstances

occur in which toil and pain can procure him some great pleasure.</p>

<p>To take a trivial example, which of us ever undertakes laborious physical exercise, except to obtain some

advantage from it? But who has any right to find fault with a man who chooses to enjoy a pleasure that

has no annoying consequences, or one who avoids a pain that produces no resultant pleasure?</p>

<p>On the other hand, we denounce with righteous indignation and dislike men who are so beguiled and demoralized

by the charms of pleasure of the moment, so blinded by desire, that they cannot foresee the pain and trouble that

are bound to ensue; and equal blame belongs to those who fail in their duty through weakness of will, which is

the same as saying through shrinking from toil and pain. These cases are perfectly simple and easy to distinguish.</p>

<p>In a free hour, when our power of choice is untrammelled and when nothing prevents our being able to do what we like best,

every pleasure is to be welcomed and every pain avoided. But in certain circumstances and owing to the claims of duty

or the obligations of business it will frequently occur that pleasures have to be repudiated and annoyances accepted.

The wise man therefore always holds in these matters to this principle of selection: he rejects pleasures to secure

other greater pleasures, or else he endures pains to avoid worse pains.

</p>

</div>

</div><!-- end "#wrapper" -->

<div id="footer">

<p>Footer information goes here. Copyright, year, Contact information, etc.</p>

</div>

</body></html>[/QUOTE]
This should look the same for all/most browsers (although I didn't check it yet).

Some tweakages on the CSS: -background-color for the "li" and add a "height" to same, some padding to "li a" will complete your desired effect.
Copy linkTweet thisAlerts:
@Barton68authorApr 13.2008 — Superb job, just a few margin issues to iron-out in IE6 lol

Thank you all for your help.

Mark.?
×

Success!

Help @Barton68 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 4.27,
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: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

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