怎么样用html语言让图片的位置向左或者是向右移动一点

来源:百度知道 编辑:UC知道 时间:2024/07/05 02:05:49
我要的不是移动的图片,只是让图片的位置向左或者是向右移动一小点,我不能直接拖动图片,因为要改的地方只能用代码打开。其他方式打不开。谢谢各位了。

给图片加个class用相对定位做就可以了

例:
<style type="text/css">
.imgPlace{ position:relative; top:5px; left:5px;/*right:5px;bottom:5px*/}
/*position:relative是相对定位的意思; top是相对离上面的距离,left是相对离左面的距离,right是相对离右面的距离,bottom是相对离下面的距离,*/
</style>

<img src="...." alt=" " title=" " class="imgPlace" />

1、<img src="" hspace="">这里的hspace指水平方向与其他元素的间隔,填个你想要的整数就行了,如果是竖直方向就用vspace,简单吧。
2、<img src="#" width="100" height="100" style=" margin-left:10px;" />在图片代码里面加上margin属性。往右移就margin-left,往左移动就margin-right。
3、给图片加个class用相对定位做就可以了。例:<style type="text/css">.imgPlace{ position:relative; top:5px;left:5px;/*right:5px;bottom:5px*/}/*position:relative是相对定位的意思; top是相对离上面的距离,left是相对离左面的距离,right是相对离右面的距离,bottom是相对离下面的距离,*/</style><img src="...." alt=" " title=" " class=&quo