Expand my Community achievements bar.

Radically easy to access on brand approved content for distribution and omnichannel performant delivery. AEM Assets Content Hub and Dynamic Media with OpenAPI capabilities is now GA.

Help with "clearing" in three column format

Avatar

Former Community Member

The code is pasted in below of a three column page I have created.  However, the background color in the sidebars does not reach to the footer it follows the content.  I know that I need to "clear" the columns but as a newbie I'm not sure how to do so.  Any help would be appreciated.

Thanks!

<!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=UTF-8" />

<title>Untitled Document</title>

<style type="text/css">

<!--

body  {

font: 100% Verdana, Arial, Helvetica, sans-serif;

background: #CCC;

margin: 0; /* it's good practice to zero the margin and padding of the body element to account for differing browser defaults */

padding: 0;

text-align: center; /* this centers the container in IE 5* browsers. The text is then set to the left aligned default in the #container selector */

color: #000000;

}

.thrColLiqHdr #container {

width: 80%;  /* this will create a container 80% of the browser width */

background: #FFFFFF;

margin: 0 auto; /* the auto margins (in conjunction with a width) center the page */

border: 1px solid #000000;

text-align: left; /* this overrides the text-align: center on the body element. */

}

.thrColLiqHdr #header {

background: #DDDDDD;

padding: 0 10px;  /* this padding matches the left alignment of the elements in the divs that appear beneath it. If an image is used in the #header instead of text, you may want to remove the padding. */

}

.thrColLiqHdr #header h1 {

margin: 0; /* zeroing the margin of the last element in the #header div will avoid margin collapse - an unexplainable space between divs. If the div has a border around it, this is not necessary as that also avoids the margin collapse */

padding: 10px 0; /* using padding instead of margin will allow you to keep the element away from the edges of the div */

}

/* Tips for sidebars:

1. Since we are working in percentages, it's best not to use side padding on the sidebars. It will be added to the width for standards compliant browsers creating an unknown actual width.

2. Space between the side of the div and the elements within it can be created by placing a left and right margin on those elements as seen in the ".thrColLiqHdr #sidebar1 p" rule.

3. Since Explorer calculates widths after the parent element is rendered, you may occasionally run into unexplained bugs with percentage-based columns. If you need more predictable results, you may choose to change to pixel sized columns.

*/

.thrColLiqHdr #sidebar1 {

float: left; /* this element must precede in the source order any element you would like it be positioned next to */

width: 30%; /* since this element is floated, a width must be given */

background: #3399FF; /* the background color will be displayed for the length of the content in the column, but no further */

padding: 15px 0; /* top and bottom padding create visual space within this div  */

}

.thrColLiqHdr #sidebar2 {

float: right; /* this element must precede in the source order any element you would like it be positioned next to */

width: 30%; /* since this element is floated, a width must be given */

background: #3399FF; /* the background color will be displayed for the length of the content in the column, but no further */

padding: 15px 0; /* top and bottom padding create visual space within this div */

}

.thrColLiqHdr #sidebar1 p, .thrColLiqHdr #sidebar1 h3, .thrColLiqHdr #sidebar2 p, .thrColLiqHdr #sidebar2 h3 {

margin-left: 10px; /* the left and right margin should be given to every element that will be placed in the side columns */

margin-right: 10px;

}

/* Tips for mainContent:

1. the space between the mainContent and sidebars is created with the left and right margins on the mainContent div.

2. to avoid float drop at a supported minimum 800 x 600 resolution, elements within the mainContent div should be 300px or smaller (this includes images).

3. in the Internet Explorer Conditional Comment below, the zoom property is used to give the mainContent "hasLayout." This avoids several IE-specific bugs.

*/

.thrColLiqHdr #mainContent {

margin: 0 24% 0 23.5%; /* the right and left margins on this div element creates the two outer columns on the sides of the page. No matter how much content the sidebar divs contain, the column space will remain. You can remove this margin if you want the #mainContent div's text to fill the sidebar spaces when the content in each sidebar ends. */

}

.thrColLiqHdr #footer {

padding: 0 10px; /* this padding matches the left alignment of the elements in the divs that appear above it. */

background:#DDDDDD;

}

.thrColLiqHdr #footer p {

margin: 0; /* zeroing the margins of the first element in the footer will avoid the possibility of margin collapse - a space between divs */

padding: 10px 0; /* padding on this element will create space, just as the the margin would have, without the margin collapse issue */

}

/* Miscellaneous classes for reuse */

.fltrt { /* this class can be used to float an element right in your page. The floated element must precede the element it should be next to on the page. */

float: right;

margin-left: 8px;

}

.fltlft { /* this class can be used to float an element left in your page The floated element must precede the element it should be next to on the page. */

float: left;

margin-right: 8px;

}

.clearfloat { /* this class should be placed on a div or break element and should be the final element before the close of a container that should fully contain its child floats */

clear:both;

    height:0;

    font-size: 1px;

    line-height: 0px;

}

a:link {

text-decoration: none;

color: #000;

}

a:visited {

text-decoration: none;

color: #000;

}

a:hover {

text-decoration: none;

}

a:active {

text-decoration: none;

}

-->

</style><!--[if IE]>

<style type="text/css">

/* place css fixes for all versions of IE in this conditional comment */

.thrColLiqHdr #sidebar2, .thrColLiqHdr #sidebar1 { padding-top: 30px; }

.thrColLiqHdr #mainContent { zoom: 1; padding-top: 15px; }

/* the above proprietary zoom property gives IE the hasLayout it needs to avoid several bugs */

</style>

<![endif]--></head>

<body class="thrColLiqHdr">

<div id="container">

<div id="header">

    <h1>Header</h1>

  <!-- end #header --></div>

  <div id="sidebar1">

<h3>Today's Top Health News</h3>

    <p>Vitmains C and E cleared in melanoma scare. </p>

<p>Older men often binge drink, too</p>

<p>Short kids are psychologically OK</p>

<p>New drug for schizophrenia and bipolar disorder approved</p>

<p>Mediterrenean Diet plus exercise lowers risk of Alzheimer's Disease</p>

<p>Not enough sleep may raise the risk of diabetes</p>

  <!-- end #sidebar1 --></div>

  <div id="sidebar2">

    <h3>Podcasts: In-depth, awarding winning Radio Health Journal Reporting</h3>

    <p><img src="../graphics/I-am-safe-now.jpg" width="106" height="80" align="left" />

<p>Perinatal Hospice: Giving meaning and easing grief when birth to death is measured in hours </p>

<p>Medical Mystery Shoppers: Fake patient who keep healthcare quality high</p>

<p>Pediatric Live Transplants: Children can receive a slice from a living adult donor</p>

<p>The Selling of healthcare reform: Why revved up rhetoric matters more than facts</p>

<p>Early Alzheimer's diagnosis: The benefits of early treatment</p>

<p>Dementia drugs: Are medications too common in nursing homes?</p>

<p>Pregorexia: Anorexia while pregnant-more common than we think</p>

<p>Mop men: People who clean up after unexpected death</p>

<p>Gout: The return of the "disease of kings"</p>

<p>Prevention and healthcare reform: How much money can prevention really save?</p>

  <!-- end #sidebar2 --></div>

  <div id="mainContent">

    <h1> Featured Content </h1>

    <p><a href="http://speakaboutbipolardepression.com/">The economy is leadiny many Americans to feel additional stress.  This is particularly concerning for the more than 8 million Americans with bipolar disorder.</a></p>

    <p>As modern medicine extends life expectancy, prevelance of Alzheimer's Disease in the U.S. is expected to skyrocket from about 5 million to 16 million in 2050.  Understanding risk factors is more important than ever. </p>

    <p>You might thing a blood transfusion ordered by a physician would be safe and effective.  But a new analysis by an international panel sbows most transfusions have little benefit.  In fact, they may be dangerous.</p>

    <h2>Information about our program's guests </h2>

    <p>Developing A Brain Eraser: Dr. Andre Fenton</p>

<p>Too sexy, Too soon: Kids, the media, and sex: Dr. Diane Levin, author of "So Sexy So Soon: The new sexualized childhood and what parents can do to protect their kids"</p>

<p>Everything You Always Wanted To Know About...Death: Harold Schechter, author of "The Whole Death Catalog: A Lively Guide To The Bitter End"</p>

<p>Borderline Personality Disorder: Randi Kreger, cofounder of BPDcentral.com</p>

<!-- end #mainContent --></div>

<!-- This clearing element should immediately follow the #mainContent div in order to force the #container div to contain all child floats --><br class="clearfloat" />

  <div id="footer">

    <p>Footer</p>

  <!-- end #footer --></div>

<!-- end #container --></div>

</body>

</html>

3 Replies

Avatar

Former Community Member

Just an update.  I've tried entering <div class: "clearfloat"></div> after the div for sidebar 1 with no success.  I know this is an easy fix but I am stumped.

Avatar

Former Community Member

Are you posting to the right forum? This is a Designer form where we are working with PDF forms. This looks like HTML!

Paul

Avatar

Former Community Member

Sorry, thought I was in the general discussion area.

Thanks!