Solved

Building a layout using css div?

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

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…
CSS is a visual language used to classify objects and define rules about how they should be displayed. CSS skills aren’t restricted to developers anymore, there is a big benefit to having a basic understanding of the language, regardless of your occ…
In this tutorial viewers will learn how add a full-size background image to a webpage using CSS3. Create a new HTML document with an internal stylesheet.: In CSS, define the html element to have a background image. Use a high resolution image.: In t…
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

623 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