473,385 Members | 1,890 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.

Parent div and children div are the same absolutely positioned.

Hi all. I have a question. Please answer.
Expand|Select|Wrap|Line Numbers
  1. <style>
  2. #div1 {
  3.         position: absolute;
  4.         top: 50px;
  5.         left: 50px;
  6.         width: 200px;
  7.         height: 200px;
  8. }
  9. .content{
  10.             position: absolute;
  11.             top :30px;
  12.             left:30px;
  13.         }
  14. </style>
[html]
<div id="div1">
This is the text of parent.
<div class="content">
This is the text of content1.
This is the text of content1.
</div>
<div class="content">
This is the text of content2.
This is the text of content2.
</div>
</div>
[/html]
In general, div1 often has a relative position. But I must set it with absolute position.
I want to ask that: if doing like that, is it correctly? I don't know what happen with it's children element. I don't care about the parent elements of div1
Dec 26 '07 #1
2 1048
drhowarddrfine
7,435 Expert 4TB
Absolutely positioned elements are removed from the normal flow of the document. However, they are always positioned relative to the nearest positioned ancestor which, in this case, is the containing "div1".
Dec 26 '07 #2
thank drhowarddrfine very much.
Dec 27 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Travis Spencer | last post by:
Hello, I am having some problem with a statically positioned element being obscured by one that is absolutely positioned. To see what I am working on, go to...
4
by: Christopher | last post by:
This should be a quick one. URL: http://cfa-www.harvard.edu/~cpilman/Stuff/flush.html Code: ============================= <!DOCTYPE HTML Public "-//W3C//DTD HTML 4.01//EN">...
8
by: Asad | last post by:
Hi, I am basically trying to accomplish drop down menus for navigation on a site. And I'm pretty much done except I am having one problem. The z-index is not working with relative positioning! ...
2
by: Sebastian Stein | last post by:
Hej, I have a table with 1 row and 2 columns. In both columns are images below each other. In the right cell are less images, so the height of this cell is smaller. Anyway, I want a...
6
by: Gert Brinkmann | last post by:
Hello, as I understand the specs http://www.w3.org/TR/CSS21/visuren.html#x19 an absolute positioned block element is positioned relative to its parent element. This is told in the german...
0
by: Walt Borders | last post by:
Hi, My problem: Merging two datasets deletes parent elements, preserves all children. I've created two dataSets. Each use the same schema, parent-child nested tables. The first dataSet is...
0
by: Karthick Kumar | last post by:
Hi, I need to create a simple parent/child hierarchical menu. I have alread used the Treeview control but my requirement is slightly different than the Treeview control. I already have the kind...
4
by: Danny Tuppeny | last post by:
Hi all, I've been trying to write some classes, so when I have a parent-child relationship, such as with Folders in my application, I don't have to remember to add a parent reference, as well as...
5
by: felipevaldez | last post by:
how can I put an element below another element, that's not absolutely positioned? so I have a n element, called X, and next to that, an element Y X Y XXXXXX
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: 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: 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?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...

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.