jquery - positioning images at top right of a div -
my question how can place image or span on top right of div. searched in google , found that
/* div contains image or span */ #div{ position:relative;} /* image or span */ #span{ position:absolute; top:0px; right:0px;}
but not finding. not take space , other things goes down or of this. please give me solution this.
use position:relative
, absolute
html
<div class="wrap"> <span>right aligned</span> </div>
css
.wrap{ position:relative; width:150px; height:150px; background:yellow } span{ display:inline-block; position:absolute; right:0; top:0; background:red }
method 2
use float:right
instead of position:absolute
.wrap{ width:150px; background:yellow; display: inline-block; } span{ background:red; float:right; display: inline-block; }
Comments
Post a Comment