?
Solved

css help for div layout required

Posted on 2012-04-11
5
Medium Priority
?
233 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

Introduction If you're like most people, you have occasionally made a typographical error when you're entering information into an online form.  And to your consternation, the browser remembers the error, and offers to autocomplete your future entr…
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
In this tutorial viewers will learn how to customize the background color and font color of highlighted text using the ::selection element in CSS Begin by defining the selected text as an element in CSS by typing "::selection": Style the ::selection…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses
Course of the Month7 days, 19 hours left to enroll

765 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