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

Placing child element relative to parent with div

Given the following in a stylesheet:

#parent
{
width: 50px;
height: 50px;
}

#child
{
width: 50px;
height: 20px;
}

<div id="parent">
<div id="child"></div>
</div>

Now, is there any way to make the bottom of the child element be right
on the bottom of the parent element? I need this to be done without
using position relative/absolute and just having top be 30px because
the parent element height is going to be dynamic. Any help
appreciated.

Rob
Jul 27 '05 #1
2 2908
Rob T. wrote:
Now, is there any way to make the bottom of the child element be right
on the bottom of the parent element?

#parent
{
width: 50px;
height: 50px;
position: relative;
}

#child
{
width: 50px;
height: 20px;
position: absolute;
bottom: 0;
}
I need this to be done without using position relative/absolute and just
having top be 30px because the parent element height is going to be
dynamic.


I don't see how you could make that limitation based on that reason. I
think, perhaps, you don't understand how positioning works properly. As far
as I can tell, it is exactly what you are after.
--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Jul 27 '05 #2
On Wed, 27 Jul 2005 21:44:11 +0100, David Dorward <do*****@yahoo.com>
wrote:
Rob T. wrote:
Now, is there any way to make the bottom of the child element be right
on the bottom of the parent element?

#parent
{
width: 50px;
height: 50px;
position: relative;
}

#child
{
width: 50px;
height: 20px;
position: absolute;
bottom: 0;
}
I need this to be done without using position relative/absolute and just
having top be 30px because the parent element height is going to be
dynamic.


I don't see how you could make that limitation based on that reason. I
think, perhaps, you don't understand how positioning works properly. As far
as I can tell, it is exactly what you are after.


You are right David. I didn't properly consider using
relative/absolute position. Thank you for the help.

Rob
Jul 28 '05 #3

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

Similar topics

3
by: Markus Ernst | last post by:
Hello Reading the follwing document: http://www.w3.org/TR/WD-positioning-970131#In-flow it seems very clear that position:relative should be relative to the parent element. So in the following...
19
by: Thomas Mlynarczyk | last post by:
Hello, The following gives different results in IE and "Non-IE" browsers: <div style="background-color: green; width: 200px"> <div style="margin-top: 20px; background-color: red"> Hello...
20
by: Geoffrey H. Goldberg | last post by:
I have made a remote control window which opens from its parent. On loading, the remote is positioned relative to the screen using window.moveTo(x,y). What I would like to happen is the remote...
1
by: objectref | last post by:
Hi to all folks, i have the following problem and i have spent many hours to solve it but without any result, so, here it is: Imagine that you have a mdi-child form that has a panel on it, a...
1
by: adamredwards | last post by:
I have a page with some form elements that are dynamically generated. They are inserted into the dom by first cloning a node, changing the values like name, and then inserted with insertBefore(). ...
4
by: patrizio.trinchini | last post by:
Hi all, I'm new to XSLT and maybe my problem have a very trivial answer, but I need an expert that point me in the right direction. What I would obtain is to remove all the elements that have a...
4
by: MA | last post by:
Hi, How to access the total number of child nodes from a parent node. For example, I would like to get the total number of child nodes from <parent1and <parent2node. The SelectNodes method...
7
by: dweeti | last post by:
Hi, I am trying to display the child element in the DOM, while hiding the parent using JS and CSS, however I cannot find a way to do this. So for example: <body> <div id="Parent"> <div...
2
by: Claudia Fong | last post by:
Hi, I have a xml document which is like this: <profile document> <Child name = profile1 id = 1> </Child> </profile document>
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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: 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...

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.