473,401 Members | 2,146 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,401 software developers and data experts.

Positioning DIVs within DIVs (need hack)


I have a problem with the positioning of two divisions.

They are containined within a content division in which all the page content happens
(ie not the menus, etc.).

The behavior I would like (and the behavior that happens in IE) is for the content
division (from now on 'ConDiv') to resize with the content of either of the sub divisions
(MainDiv and NewsDiv).

I am trying to get the divisions to position directly next to each other. The fix I first
came up with is using float:left and float:right. Dreamweaver and IE both claim that this
should do as I require but Firefox just floats the divisions plain over the entire document
(with the top aligned to the top of ConDiv but the actual content floating over the footer
of the page and heading on down to nowhere.

http://www.bfwd.co.uk/clients/shiningstar/taffhousing

Load this page in firefox to see what I mean - and in IE to see what I actually want.

Help :S
------------------------------------

Another unchecked rambeling brought to you by:

Oddball
joshua@bf#N0SP4M#wd.co.uk
Jul 21 '05 #1
3 4650
On Wed, 20 Jul 2005, Oddball wrote:
I have a problem with the positioning of two divisions.
They are containined within a content division in which all the page content happens
(ie not the menus, etc.).
[...]


One wonders what's the use of all these HTML elements.
It seems that DIV and SPAN are enough. There should be something
like "Compact HTML 4.01", which has only DIV and SPAN.

Jul 21 '05 #2


Andreas Prilop <nh******@rrzn-user.uni-hannover.de> wrote:
On Wed, 20 Jul 2005, Oddball wrote:
I have a problem with the positioning of two divisions.
They are containined within a content division in which all the page content happens (ie not the menus, etc.).
[...]


One wonders what's the use of all these HTML elements.
It seems that DIV and SPAN are enough. There should be something
like "Compact HTML 4.01", which has only DIV and SPAN.

Does that help me? :S If I'm missing something please tell me :'(
------------------------------------

Another unchecked rambeling brought to you by:

Oddball
joshua@bf#N0SP4M#wd.co.uk
Jul 21 '05 #3
Oddball wrote:
I have a problem with the positioning of two divisions.

They are containined within a content division in which all the page
content happens (ie not the menus, etc.).

The behavior I would like (and the behavior that happens in IE) is
for the content division (from now on 'ConDiv') to resize with the
content of either of the sub divisions (MainDiv and NewsDiv).

I am trying to get the divisions to position directly next to each
other. The fix I first came up with is using float:left and
float:right. Dreamweaver and IE both claim that this should do as I
require but Firefox just floats the divisions plain over the entire
document (with the top aligned to the top of ConDiv but the actual
content floating over the footer of the page and heading on down to
nowhere.


It looks to me like you're doing a 2-column layout with header & footer -
would that be correct?

One question about that - do you WANT the "Latest News" div to be lined up
BELOW the "Welcome" div, or right next to it?

Take a look at my site: http://www.webrightdevelopment.com and see if that
seems to be what you want. I have a header, a middle portion with two
columns, and a footer. If that's what you're trying to achieve, here are a
couple tips:

First off, to get the placement of the footer where you want it, after using
float for the two columns, you need to add 'clear:both'.

To get the layout you want, you will need a container div for everything.
Then the header, then the middle section with its two columns, and finally
the footer. It should come out something like this:

<div id='wholepage' style='background-color:white; width:80%;'>
<div id='header' style='background-color:white; width:100%;'>
--Header Stuff Here--
</div>
<div id='middle' style='background-color:white; width:100%;'>
<div id='leftcolumn' style='background-color:white; width:50%;
float:left;'>
--Left Column Stuff Here--
</div>
<div id='rightcolumn' style='background-color:red; width:49%;
float:right;'>
--Right Column Stuff Here--
</div>
</div>
<div id='footer' style='background-color:blue; width:100%; clear:both;'>
--Footer Stuff Here--
</div>
</div>

BTW, you'll see that the two columns only add up to 99%. I did this because
I've noticed that in some browsers, putting two 50% width divs next to each
other sometimes causes them to move vertically while resizing the browser
window.

Also note that with this design, the LEFT column will visually appear to
match the full height of the middle div, but the right column won't - this
assumes that the right column is the one that will take up the most space,
and therefore the left column will have to adjust to the right. What really
happens is that the left column div cuts off at the bottom of its contents,
but since the wholepage div has the same background color, it APPEARS to
fill all the way to the footer. If you were to put a border around it, or
change the background color, you would see this.

Hope that helps - I remember when I was just learning CSS and trying to do
this (not all that long ago, actually) - it was a pain...

--
Tony Garcia
Web Right! Development
Riverside, CA
www.WebRightDevelopment.com
Jul 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Bryan R. Meyer | last post by:
Hello Everyone, The problem of browser resizing has become an issue for me. While redesigning my webpage, I set the left and right margins to be auto so that my content would be centered. ...
2
by: Egon Pasztor | last post by:
Hi. I'm new at CSS, so maybe this is obvious, but I've looked around quite a bit looking for a solution. I'm playing with the vertical positioning of elements in a 2-column layout. The...
1
by: David Ehmer | last post by:
Within divs my pages are rendering with the 2nd and subsequent elements indented slightly. eg the first paragraph, list item or heading is where it should be, all the rest in the div (whether...
7
by: qwerty | last post by:
Following works in Mozilla, Opera and IE. <div style=" left: 100px; right: 200px; /* JavaScript-hack for IE*/ width: expression((document.body.clientWidth - 100 - 200) + 'px') ">...
1
by: no0bodyhome | last post by:
Why am I having so much trouble positioning divs? Am I in a tables mindset here? Why doesn't content flow below or alongside where it is suppose to? I created the example below to give you...
17
by: George Hester | last post by:
http://tinyurl.com/5uj6w The lower middle icon the "block" should not drop down when the mouse is over it. How can I stop that? Also the navigation divs both top and bottom should follow the...
2
by: nonsensitor | last post by:
I'm just learning xhtml & css, primarily from westciv's online tutorials and css guide. I've run into a couple of problems with a page I'm developing that I can't figure out. The first problem is...
3
by: vunet | last post by:
When I use image as a bullet within LI element I have different image positioning results in Firefox and IE6. IE6 puts the image on top and far from left LI's border. Firefox puts it nicely in the...
14
by: Fistro | last post by:
I'm trying to find a design that would allow me to build web pages without having to worry about compatibility issues (not too much, in any case,,,) I've came across this CSS layout technique:...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.