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 } 

demo


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; } 

demo 2


Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

css - Can I use the :after pseudo-element on an input field? -