Solved

css help for div layout required

Posted on 2012-04-11
5
228 Views
Last Modified: 2012-06-22
layout wanted
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.
0
Comment
Question by:blue-genie
  • 2
  • 2
5 Comments
 
LVL 3

Expert Comment

by:gnemi
ID: 37832076
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

0
 
LVL 12

Expert Comment

by:Anuradha Goli
ID: 37832494
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
output
0
 
LVL 39

Author Comment

by:blue-genie
ID: 37834643
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.

not top aligned.
0
 
LVL 3

Accepted Solution

by:
gnemi earned 500 total points
ID: 37835216
Tested in Chrome, FF, and IE8

<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title>Untitled Page</title>
    <style>
.wideBox {
  border: 1px solid grey;
  margin: 2% 5% 2% 5%;
  padding: 10px;
  text-align: center;
}
.loginBox {
  border: 1px solid grey;
  margin-left: 5%;
  padding: 10px;
  float: left;
  width: 20%;
}
.newsBox {
  border: 1px solid grey;
  margin-right: 5%;
  padding: 10px;
  float: right;
  width: 65%;
}</style>
</head>
<body>
<div class="wideBox"></div>
<div class="loginBox"></div>
<div class="newsBox"></div>
</body>
</html>

Open in new window

0
 
LVL 39

Author Closing Comment

by:blue-genie
ID: 37838986
thanks alot - i'll be back once i get a little further in my css journey :-)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Wordpress CSS Link Issue 2 34
Add animation to your css 12 32
alert before form submission 6 31
two div layout one vertical other horizontal. 5 8
Unordered lists (HTML ul tags) are very handy to create menus of all types, shapes and sizes.  All it takes is a little knowledge of CSS and the possibilities are endless. First off, you should know the general format for menus created using the …
Introduction A frequently asked question goes something like this:  "I am running a long process in the background and I want to alert my client when the process finishes.  How can I send a message to the browser?"  Unfortunately, the short answer …
In this tutorial viewers will learn how to position items using CSS's three positioning types Create a new HTML document with an internal stylesheet.: Create another div in CSS and name it Absolute : Type "position:absolute;" and "top:10px; left:50p…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now