fidgen
11-28-2008, 03:27 PM
Hiya,
I'm trying to create a 3 column layout, with a seperate block system in the central column, which again can have up to 3 columns. Like this:
6908
I've created the layout, but i'm having problems with the floated divs and where to clear them. If the left column is too long, the entire contents of the center div are shunted down the page because of the div-clear. I need to clear JUST the center div, not the whole page. I know you can use position:relative to do this sort of thing but i can't get it working!
All help appreciated ;)
Styles so far...
#left-column {
float: left;
}
#right-column {
float: right;
}
#center-column {
}
#usermodules { /*u1, u2, u3*/
padding: 0px 0px 0px 0px;
}
#user2modules { /*u4, u5, u6*/
padding: 0px 0px 0px 0px;
}
#blockw99 {float: left; width: 99%; padding:0 5px 0} /*used to auto change the width to fit in 3 columns if blocks turned on or off*/
#blockw49 {float: left; width: 47%; padding:0 5px 0} /*used to auto change the width to fit in 2 columns if blocks turned on or off*/
#blockw33 {float: left; width: 30%; padding:0 5px 0} /*used to auto change the width to fit in 1 column if blocks turned on or off*/
html so far...
<!-- Begin Main Content Area -->
<div id="main-section">
<!-- Begin Left Column -->
<div id="left-column">
<jdoc:include type="modules" name="left" style="rounded" />
</div>
<!-- End Left Column -->
<!-- Begin Right Column -->
<div id="right-column">
<jdoc:include type="modules" name="right" style="rounded" />
</div>
<!-- End Right Column -->
<!-- Begin Center Column -->
<div id="center-column">
<?php if ($this->countModules('user1') or $this->countModules('user2') or $this->countModules('user3')) : ?>
<div id="usermodules" class="spacer<?php echo "$usermod_width";?>">
<?php if ($this->countModules('user1')) : ?>
<div id="block<?php echo "$usermod_width";?>">
<jdoc:include type="modules" name="user1" style="rounded" />
</div>
<?php endif; ?>
<?php if ($this->countModules('user2')) : ?>
<div id="block<?php echo "$usermod_width";?>">
<jdoc:include type="modules" name="user2" style="rounded" />
</div>
<?php endif; ?>
<?php if ($this->countModules('user3')) : ?>
<div id="block<?php echo "$usermod_width";?>">
<jdoc:include type="modules" name="user3" style="rounded" />
</div>
<?php endif; ?>
</div>
<div style="clear:left"></div>
<?php endif; ?>
<jdoc:include type="message" />
<jdoc:include type="component" />
</div>
<div class="clear"></div>
<!-- End Center Column -->
</div>
<!-- End Main Content Area -->
I'm trying to create a 3 column layout, with a seperate block system in the central column, which again can have up to 3 columns. Like this:
6908
I've created the layout, but i'm having problems with the floated divs and where to clear them. If the left column is too long, the entire contents of the center div are shunted down the page because of the div-clear. I need to clear JUST the center div, not the whole page. I know you can use position:relative to do this sort of thing but i can't get it working!
All help appreciated ;)
Styles so far...
#left-column {
float: left;
}
#right-column {
float: right;
}
#center-column {
}
#usermodules { /*u1, u2, u3*/
padding: 0px 0px 0px 0px;
}
#user2modules { /*u4, u5, u6*/
padding: 0px 0px 0px 0px;
}
#blockw99 {float: left; width: 99%; padding:0 5px 0} /*used to auto change the width to fit in 3 columns if blocks turned on or off*/
#blockw49 {float: left; width: 47%; padding:0 5px 0} /*used to auto change the width to fit in 2 columns if blocks turned on or off*/
#blockw33 {float: left; width: 30%; padding:0 5px 0} /*used to auto change the width to fit in 1 column if blocks turned on or off*/
html so far...
<!-- Begin Main Content Area -->
<div id="main-section">
<!-- Begin Left Column -->
<div id="left-column">
<jdoc:include type="modules" name="left" style="rounded" />
</div>
<!-- End Left Column -->
<!-- Begin Right Column -->
<div id="right-column">
<jdoc:include type="modules" name="right" style="rounded" />
</div>
<!-- End Right Column -->
<!-- Begin Center Column -->
<div id="center-column">
<?php if ($this->countModules('user1') or $this->countModules('user2') or $this->countModules('user3')) : ?>
<div id="usermodules" class="spacer<?php echo "$usermod_width";?>">
<?php if ($this->countModules('user1')) : ?>
<div id="block<?php echo "$usermod_width";?>">
<jdoc:include type="modules" name="user1" style="rounded" />
</div>
<?php endif; ?>
<?php if ($this->countModules('user2')) : ?>
<div id="block<?php echo "$usermod_width";?>">
<jdoc:include type="modules" name="user2" style="rounded" />
</div>
<?php endif; ?>
<?php if ($this->countModules('user3')) : ?>
<div id="block<?php echo "$usermod_width";?>">
<jdoc:include type="modules" name="user3" style="rounded" />
</div>
<?php endif; ?>
</div>
<div style="clear:left"></div>
<?php endif; ?>
<jdoc:include type="message" />
<jdoc:include type="component" />
</div>
<div class="clear"></div>
<!-- End Center Column -->
</div>
<!-- End Main Content Area -->