Jump to content

Moving images left and right.


24-play.com

Recommended Posts

A few days ago I came across some HTML code that moves an image left and right by adding pixels. Since then I've forgotton it. Does anybody know it?A friend recomended some CSS code along the lines of

style="right;20px"

that is imbedded in the <img> tag, but this is not the correct code. I'm certain the code I'm after is HMTL, only I've forgotten it. :) All I am trying to do is move an image ten or pixles to the right.

Link to comment
Share on other sites

are you talking about <img src="xxxxxx.xxx" hspace="5" vspace="0" .... >

Thats not the code I found - though I had seen that code in the w3c site.
this?<img style="left:10px;top:0px;position:relative;" src="xxx.jpg" />

That could well be the one. If it is, it means my friend didn't tell me the CSS code correctly, because forgive me if I'm wrong thats CSS.Thankyou both - thats solved the issue.
Link to comment
Share on other sites

  • 3 weeks later...

You can also use absolute positioning. <img src="...", style= "positionabsolute: left:'157px', top:'528px', z-index:'1'; ">You can also use percentages not only pixels when using abosolute positioning. The z-index is not necesary unless you have over-lapping pictures. The highest z-index is the picture on top. And so on.

Link to comment
Share on other sites

now add some javascript to dynamically change the values for positioning and you have movement - since you said "moves an image left and right " in your original post. If you just need to reposition it, then the examples provided with suffice.

Link to comment
Share on other sites

You can also use absolute positioning.  <img src="...", style= "positionabsolute: left:'157px', top:'528px', z-index:'1'; ">You can also use percentages not only pixels when using abosolute positioning.  The z-index is not necesary unless you have over-lapping pictures.  The highest z-index  is the picture on top. And so on.

I don't think you 'quote' values in css... :)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...