Mohammad Fadin
Mohammad Fadin

Reputation: 579

positioning an image using HTML

Lets say I have an image and I would like to position it not exactly at the center nor at right, what html code I should be using to do this?

I want to put the exact position I want instead of using center or right or left.

Thanks

Upvotes: 0

Views: 78

Answers (3)

I think you have to use at least a little bit of CSS. With inline CSS it is easy to use (but maybe not the best way doing it inline).

So use the style attribute in HTML and set the position with CSS.

style="position:absolute; top:30px; left:10px;"

With position:fixed; ... you can set the image always at the same position of your screen, even when you are scolling down the page.

Upvotes: 0

AlenBer
AlenBer

Reputation: 748

Using margins and Padding via CSS. Look at this link.

Upvotes: 0

Jared Farrish
Jared Farrish

Reputation: 49188

Like this?

<img style="position: absolute; right: 30%; top: 25%;" src="http://www.gravatar.com/avatar/e1122386990776c6c39a08e9f5fe5648?s=128&d=identicon&r=PG"/>

http://jsfiddle.net/NVum7/

I think you probably want to learn about CSS positioning:

http://www.alistapart.com/articles/css-positioning-101/

Upvotes: 1

Related Questions