var parentDiv = $("#parent");
parentDiv.css({
"position" : "relative",
"height" : "100px",
"width" : "200px"
});
var childDiv = $("<div></div>").appendTo(parentDiv);
childDiv.prop("id","child");
childDiv.css({
"position" : "absolute",
"height" : "50px",
"width" : "50px",
"top" : "10px",
"left" : "10px"
});
Now the child div element is placed under absolutely within the parent div according to the css properties of top, left, right, bottom. You can have any number of child div elements positioned like this and change the positioning properties accordingly.
No comments:
Post a Comment