relative positionining

When an element is given relative positioning, its half in the flow and not. Its position in the flow remains, while the rendered item appears relocated.

by fezec

HTML

<div id="parent">
    <span>test</span>
    <div id="child">a</div>
    <span>test</span>
</div>

CSS

#parent{
    width:500px;
    height:500px;
    position:relative;
    background:green;
    border:1px solid red;
}

#child{
    background:blue;
    position:relative;
    margin:0;
    padding:0;
    border:1px solid black;
    top:10px;
    left:50px;
}

JavaScript

/*$("body").bind("mousemove",function(e){
 
var w=e.clientX/ ($(document).width()) ;
    $("#parent").width(w*500);
});*/