Link to home
Start Free TrialLog in
Avatar of flow79
flow79Flag for United States of America

asked on

2 column layout - smooth resize

hello all!

Please see my code below and tell me why when you shrink the page horizontally, sometimes the blog div shifts down, and sometimes it doesnt.  what do i need to add to my css to make it resize smoothly?  thanks a bunch!

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<title>Untitled</title>

<style type="text/css">
<!--

body {
      background-color: #003366;
      margin: 0px;
      font-size: 8pt;
      font-family: georgia, verdana;
      }

.main {
      width: 90%;
      height: 100%;
      background-color: #003366;
      }
      
.header {
      color: #003366;
      width: 100%;
      height: 20%;
      background-color: #00ffff;       
      padding: 5px;
      }
      
.menu {
      color: #ffffff;
      width: 25%;
      height: 100px;
      background-color: #003366;
      float: left;
      padding: 5px;
      }
      
.blog {
      color: #ffffff;
      width: 75%;
      height: 100%;
      background-color: #3399cc;
      float: right;
      padding: 5px;
      text-align: center;
      }
      
.blogtitle {
      font-size: 12pt;
      font-weight: bold;
      }
      
.blogheader {
      width: 90%;
      background-color: #003366;
      margin-bottom: 5px;
      }      
      
.blogcontent {
      width: 90%;
      background-color: #003366;
      }

-->
</style>

</head>
<body>

<div class="main">
      <div class="header">
            Header
      </div>
      <div class="menu">
            Menu
      </div>
      <div class="blog">
            <div class="blogheader">
                  <div class="blogtitle">Title</div>
            </div>
            <div class="blogcontent">
                  Content
            </div>            
      </div>
</div>

</body>
</html>
ASKER CERTIFIED SOLUTION
Avatar of COBOLdinosaur
COBOLdinosaur
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of flow79

ASKER

C&d,
  I've removed all of the height: 100% values. However, I still have the .header, and .blogheader set with absolute height values - the page still breaks when its resized horizontally.  any more ideas?
I need to see the new code or a link to the page.

Cd&
Avatar of flow79

ASKER

I actually just recoded it without heights, and it seems to work fine.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<title>2 column layout with divs</title>
<style type="text/css">
<!--
body { background-color: #ffffcc; }
.main {
      width: 800px;
      background-color: #003366;
      }
.header {
      width: 800px;
      height: 75px;
      background-color: #3399cc;
      padding: 10px;
      }
.left {
      width: 50%;
      background-color: #0000ff;
      float: left;
      margin-bottom: 20px;
      padding: 10px;
      }
.right {
      width: 50%;
      background-color: #ffffff;
      float: right;
      margin-bottom: 20px;
      padding: 10px;
      }
-->
</style>
</head>
<body>
<div class="main">
      <div class="header">
      Header
      </div>
      <div class="left">
      left
      </div>
      <div class="right">
      right
      </div>
</div>
</body>
</html>


Thanks C&d for letting me know about the height issue.

you get the points!
Yeah with CSS sometimes less is better.  The browser will try to optimize but if you restrict it too much it gets jammed.  Of course we blame the browser or the CSS when that happens, but 99% of problems on a page are developer error; we just need to work with the tchnologies.  Glad I could help.  Thanks for the A. :^)

Cd&