Link to home
Start Free TrialLog in
Avatar of blue-genie
blue-genieFlag for South Africa

asked on

css help for div layout required

User generated image
i'm using this

.wideBox {
  clear: both;
  width: 90%;
  text-align: center;
  margin: 70px;
  padding: 10px;

  background: #FFFFFF;
  border: 1px solid grey;
}

.loginBox {
    width: 20%;
      margin: 70px;
      height: auto;
    float:left; /* add this */
    border: 1px solid grey;
      padding: 10px;
}
.newsBox {
    border: 1px solid grey;
      width: 65%;
    overflow: hidden; /* if you don't want #second to wrap below #first */
      display: block;
      font-size: 1.2em;
      padding: 10px;
}

to try and get the boxes to line up as per the image. it's not happening.
the top one (widebox) is fine.
the bottom 2 i want to be the same size (combined with gap in the middle) as the wide box - and they must be aligned on top.

help please.
Avatar of gnemi
gnemi
Flag of United States of America image

in .loginBox change margin to margin-left

in .newsBox add float: right; and margin-right: 100px;
.wideBox {
  clear: both;
  width: 90%;
  text-align: center;
  margin: 70px;
  padding: 10px;

  background: #FFFFFF;
  border: 1px solid grey;
}

.loginBox {
    width: 20%;
    margin-left: 70px;
    height: auto;
    float:left; /* add this */
    border: 1px solid grey;
    padding: 10px;
}
.newsBox {
    border: 1px solid grey;
    width: 65%;
    overflow: hidden; /* if you don't want #second to wrap below #first */
    display: block;
    font-size: 1.2em;
    padding: 10px;
    float: right;
    margin-right: 100px;
}

Open in new window

Try this code it might help you resolve the issue.
When you use div tags be careful with padding and margins, because they vary depending on the browser you choose
I viewed this code in Chrome ..
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title>Untitled Page</title>
    <style>
    .wideBox {
  clear: both;
  width: 90%;
  text-align: center;
  margin: 70px;
  padding: 10px;
  background: #FFFFFF;
  border: 1px solid grey;
}
.loginBox {
    width: 20%;
      margin: 70px;
      height: auto;
    float:left; /* add this */
    border: 1px solid grey;
      padding: 10px;
}
.newsBox {
    border: 1px solid grey;
      width: 65%;
    overflow: hidden; /* if you don't want #second to wrap below #first */
      display: block;
      font-size: 1.2em;
      padding: 10px;
}</style>
</head>
<body>
<div class="wideBox"></div>
<div class="loginBox"></div>
<div class="newsBox"></div>
</body>
</html>

Open in new window

You can adjust width and height based on your requirements. I just used your code to make sample.
Out put viewed as attached image
User generated image
Avatar of blue-genie

ASKER

genemi - the changes you suggest don't seem to do it, the newbox (Bottom right) wraps under the login box (bottom left)

anuradhay - i get the following if i copy / paste your code.

User generated image
ASKER CERTIFIED SOLUTION
Avatar of gnemi
gnemi
Flag of United States of America 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
thanks alot - i'll be back once i get a little further in my css journey :-)