Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using absolute image position

I have an list of cliped image , each one has absoulate positon :

<img style='position:absolute;clip(xpx xpx xpx xpx);'/>
<img style='position:absolute;clip(xpx xpx xpx xpx);'/>
<img style='position:absolute;clip(xpx xpx xpx xpx);'/>
<img style='position:absolute;clip(xpx xpx xpx xpx);'/>
<img style='position:absolute;clip(xpx xpx xpx xpx);'/>

The problem here is that all of the images are in the same place , I want the go next to others .

I do absolute position because of Cliping image ;

what can I do ?

like image 226
Ata Avatar asked Apr 23 '26 12:04

Ata


1 Answers

Why you then position them absolutely?

To dynamically put them right after another, you need to wrap them into something that is not positioned absolutely. Like a relativ positioned list element

<ul>
   <li style="position:relative">
        <img src="" style="position:absolute" />
   </li>
</ul>

if you cannot wrap them, you would have to do it with javascript, something like this.

var memo = 0;
$("img").each(function() {
   $(this).css("left", memo+"px");
   memo += $(this).outerWidth(true);
});
like image 146
Luke Avatar answered Apr 25 '26 01:04

Luke



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!