Solved

Building a layout using css div?

Posted on 2007-03-25
5
275 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
Comment Utility
#content {
border:1px solid black;
}

would give you a border.
0
 

Author Comment

by:AntoniRyszard
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

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…
So you have coded your own WordPress plugin and now you want to allow users to upload images to a folder in the plugin folder rather than the default media location? Follow along and this article will show you how to do just that!
In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: block…
In this tutorial viewers will learn how to style a decorative dropcap for the first letter in a paragraph using CSS. In CSS, create a new paragraph class by typing "p.fancy": Then, to style only the first letter of the first sentence, include the ps…

771 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

14 Experts available now in Live!

Get 1:1 Help Now