Solved

Building a layout using css div?

Posted on 2007-03-25
5
282 Views
Last Modified: 2010-07-27
Hello,

I wondered if anyone could advise, in my html code I have a div for the main content area.

<div id="content">
</div>

I am trying to build a layout in the content similar to these images:

http://www.members.aol.com/antoniryszard/layout-test.jpg
http://www.members.aol.com/antoniryszard/layout-test.bmp

Could anyone advise how best to divide the content to achieve this, would there be any css functions to draw a border?

Thank you


0
Comment
Question by:AntoniRyszard
  • 2
  • 2
5 Comments
 
LVL 11

Expert Comment

by:JamesCssl
ID: 18789666
#content {
border:1px solid black;
}

would give you a border.
0
 

Author Comment

by:AntoniRyszard
ID: 18796300
Hello,

This image shows the type of layout I am trying to achieve, the page has a header and footer. This part will form the middle section the content.

http://www.members.aol.com/antoniryszard/layout-image.jpg

I have already created a div content

<div id="content">
</div

Could anyone advise how I could best divide the content div to achieve my layout. I was thinking of dividing the content to a float left and right? And then dividing the left, in two again?

Thank you
0
 
LVL 4

Accepted Solution

by:
opho earned 72 total points
ID: 18801979
Here's a start, if I get your drift:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
 <meta http-equiv="Content-Type" content=
 "text/html; charset=us-ascii" />
<style type="text/css">
body {
text-align:center;
}
#content {
margin: 10px auto;
padding:5px;
width:750px;
text-align:left;
border:1px solid blue;
background:#ddd;
}
p {
margin-bottom:10px;
}
#services {
width:240px;
float:right;
border:1px solid red;
background:#eee;
}
#intro {
margin:0 10px;
border:1px solid red;
margin-right: 250px;
background:#eee;
}
.clear {
clear:both;
height:10px;
}
</style>
 <title></title>
</head>
<body>
 <div id="content">
  <p>Lorem Ipsum is simply dummy text of the printing and
  typesetting industry. Lorem Ipsum has been the industry's
  standard dummy text ever since the 1500s, when an unknown printer
  took a galley of type and scrambled it to make a type specimen
  book. It has survived not only five centuries, but also the leap
  into electronic typesetting, remaining essentially unchanged. It
  was popularised in the 1960s with the release of Letraset sheets
  containing Lorem Ipsum passages, and more recently with desktop
  publishing software like Aldus PageMaker including versions of
  Lorem Ipsum.</p>
  <div id="footer">
   <div id="services">
    service boxes go here<br />
    <br />
    <br />
    <br />
   </div>
   <div id="intro">
    Born as an idea... goes here
   </div>
  </div>
  <div class="clear"></div>
 </div>
</body>
</html>

--Steve
0
 

Author Comment

by:AntoniRyszard
ID: 18803058
Thank you,

Could I possible ask how you would divide <div id="intro">

To display both boat image and next to this the text begining, Born as an idea... goes here

http://www.members.aol.com/antoniryszard/layout-image.jpg
0
 
LVL 4

Expert Comment

by:opho
ID: 18803263
You don't need to split that div, because you can make the image float to the right of that div.  Your img tag would look something like:

<img class="floatright" src="....yadda yadda" />

and you can add this to the style info:

img.floatright {
float:right;
}

and, you'll probably end up tweaking how you contruct and style the text on the left, because once the image is floated, it doesn't force the height of the intro div to match its height...

--Steve
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

CSS3 Custom checkboxes This article shows how to style the checkbox form element using only CSS. Works in: Chrome, FF, Safari, Opera, IE9+ Uses modernizr.js to check for :checked pseudo class, falling back to plain old checkboxes (IE8 and bel…
As a result of several questions about how to use Bootstrap I thought it would be a good idea to write down the development aspect of creating a Bootstrapped website in as little time as possible. Part 1 of this article will only concentrate on g…
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
In this tutorial viewers will learn how to style rounded corners for elements in CSS using the border-radius property Begin with a normal styled element such as a div: To style all four corners of the div to be the same degree of roundness, use the …

713 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