Articles with tag: css absolute

Parent Child Positioning – CSS

–Notice that the parent element should always has relative position and all the child must have absolute position–

[html]

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style>
#content {
position:relative;
width:400px;
height:200px;
margin:10% auto;
background:blue;
}
#positioned {
position:absolute;
top:20px;
left:20px;
}
#p1 {
position:absolute;
top:100px;
left:20px;
}
#p2 {
position:absolute;
top:30px;
right:20px;
}
</style>
</head>

<body>
<div id="content">
<img id="positioned" src="logo.png" />
<p id="p1">asdasd asdasd asdaskndfs kdsgjdkf asjdewifk asdksa;kfdf samdksajdd, asdhasjdhdsfksdfjsd
asjdjasdasdm,asdnas
as,dma.,sdma.,sdma.sd ijjfsdkj
</p>
<p id="p2">
category of news:
</p>
</div>
</body>
</html>

[/html]