Solved

Building a layout using css div?

Posted on 2007-03-25
5
277 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

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

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…
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 tutorial viewers will learn how to define a gradient in CSS. Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Gradient. Define the background as "linear-gradient(to right, #ee3668, black)". Ensure you …
In this tutorial viewers will learn how to style different bullet points for unordered lists in CSS. Begin with a normal unordered list; the default bullet point is a solid circle: In the CSS, create a defined class of unordered list by typing "ul.S…

930 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

17 Experts available now in Live!

Get 1:1 Help Now