473,385 Members | 1,766 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,385 software developers and data experts.

CSS Problem with Nested DIVs

I working on a page that has two nested DIV elements. The child DIV is
absolutely positioned within the parent DIV. The contents of the child
DIV are dynamic, but no matter how large it get, I want the child to be
rendered totally within the parent DIV. As things stand, as the child
DIV grows, it overflows and sticks out. How can I style the parent so
that it always is larger than the child?

Oct 14 '05 #1
4 2509
CSS question, but never mind ...

On 14 Oct 2005 16:19:37 -0700, Vi***************@gmail.com wrote:
I working on a page that has two nested DIV elements. The child DIV is
absolutely positioned within the parent DIV. The contents of the child
DIV are dynamic, but no matter how large it get, I want the child to be
rendered totally within the parent DIV. As things stand, as the child
DIV grows, it overflows and sticks out. How can I style the parent so
that it always is larger than the child?


There is not really any such thing as "absolutely positioned within the
parent DIV". Once you absolutely position something, you take it out of
the flow, and it is no longer within anything (except the document).

I suspect that what you are asking for is not possible without
scripting. You might consider using floats rather than absolute
positioning, along the lines of
http://www.xs4all.nl/~sbpoley/webmatters/layout3.html

--
Stephen Poley

http://www.xs4all.nl/~sbpoley/webmatters/
Oct 15 '05 #2
thanks a lot for the advice. i'll check it out on monday.

Oct 16 '05 #3
On Saturday 15 October 2005 06:10, Stephen Poley wrote:
CSS question, but never mind ...

On 14 Oct 2005 16:19:37 -0700, Vi***************@gmail.com wrote: [...]

There is not really any such thing as "absolutely positioned within
the parent DIV". Once you absolutely position something, you take it
out of the flow, and it is no longer within anything (except the
document).


Is 'parent DIV' not the same as containing block?

<quote specs>
absolute
The box's position (and possibly size) is specified with the 'left',
'right', 'top', and 'bottom' properties. These properties specify
offsets with respect to the box's containing block. Absolutely
positioned boxes are taken out of the normal flow. This means they have
no impact on the layout of later siblings. Also, though absolutely
positioned boxes have margins, they do not collapse with any other
margins.
</quote specs>

Does this not mean you could absolutely position a child within it's
parent div?

--
Robert

Oct 20 '05 #4
Robert wrote:

Is 'parent DIV' not the same as containing block?
No. The containing block is the first ancestor that is positioned
(absolute, relative or fixed). That may be the parent, grandparent, or
some other element up the tree. If no ancestors are specifically
positioned, body becomes the containing block.
Does this not mean you could absolutely position a child within it's
parent div?


If the parent is positioned, you can absolutely position a child within
it by setting top, left, etc. on the child. Those properties are now
relative to the parent, not body.

Just be careful what you wish for and use absolute positioning wisely.
I've seen way too many sites that attempt pixel-perfect layouts using
absolute positioning, but only end up terribly broken with my
larger-than-average text size. :(

--
Reply email address is a bottomless spam bucket.
Please reply to the group so everyone can share.
Oct 20 '05 #5

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

Similar topics

2
by: LoserInYourFaceEngineer | last post by:
Hello All: I'm having trouble with a recursive function. The function is supposed to identify nested folders in a hierarchical folder structure. The function "searchForFolders()" is...
2
by: AGChandler | last post by:
Hi, I have a div (class = "brands") containing other divs, each of which contains an image. I'm trying to set padding around the images, and my style seems to work okay on all but Explorer (I'm...
3
by: Philip | last post by:
I am trying to make a bunched of left-floated divs that will be contained in a larger div. the floated divs all contain a left-floated img and text of varying sizes. If I don't set a height (or...
12
by: deko | last post by:
Is there any way to work around the blank space created by hidden divs? I'm trying to use a relatively postioned divs with show/hide behaviors to annotate an image. The divs show/hide...
4
by: drdeadpan | last post by:
Hi, Being a newbie, pardon me if this question has been answered. I was finding it difficult to search for my problem on Usenet 'cos I was having a tough time describing it.. Here gow. I...
2
by: Guadala Harry | last post by:
Please follow my thinking here and tell me if I'm nuts or if this is a reasonable thing to do given the objective: I'd like to present 3 data values on an aspx page - each styled uniquely, and...
4
by: Graeme | last post by:
Hi all. This is driving me mad! What I am after is a page header that will look roughly like: (the dots and arrows would be centered and are graphics) .............> page header text...
2
by: esteuart | last post by:
I need to get the right combination for a div to clip any text inside and allow vertical alignment. I only have this problem in FireFox. I have 3 divs nested within each other. The outer div has...
2
by: Ben C. | last post by:
Hi If I have a container div and inside the container div I float two divs (one left and one right), the containting div will collapse as the floated divs will no longer prop it up, meaning that...
3
by: Steve | last post by:
Hi; I'm working on a demo of using a timer on a web site that is made visible by making a div visible. My "PopIn Box" div is empty on the page. Before making it visible I used javascript to...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...

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.