Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

css help for div layout required

Posted on 2012-04-11
5
Medium Priority
?
234 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

This is a how to build your own CSS3 slideshow and when I say CSS3 I mean just CSS with no javascript in sight! There a few examples online of how to do this but most just show you an example without any explanation, others make it more complicat…
This article discusses four methods for overlaying images in a container on a web page
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
Suggested Courses

609 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