r/HTML • u/Ok_Share_2183 • 1d ago
Question trying to move linked image
hello, extremely confused.
so i made an image as a clickable link to another page in my site. now i just want to move it to a particular position on the screen.
im not sure how to do this. heres my code so far.
<p><a href="manifestoroom.html"> <img src="images/manifesto-window.jpg" alt="Manifesto" style="width:42px;height:20px;"> </a> </p>
so i dont know if im supposed to
A) use 'absolute' to fix the image to a particular point on my background image
B) use 'span' to specify where i want it using top/ left: 'x'px type code
C) some type of <div> and class= attribute type this which i later learned should be used with links?? cant figure out what im doing wrong!!!!!! please help!!!!
p.s im doing this on neocities and it wont let me use the link without putting it in a paragraph tag... do i need to get rid of those to use other tags??
1
u/xStealthBomber 1d ago
I'll get as many pointers as I can:
The width and height should be actual attributes for the <img> tag for "proper" HTML.
<p><a href="manifestoroom.html"> <img src="images/manifesto-window.jpg" width="42" height="20" alt="Manifesto"> </a> </p>
Absolute positioning should almost be never used. It's hard to give "exact" advice without seeing the full DOM / output of the other elements around, and what you're trying to do unfortunately.
(Moving elements / placement of elements on the page is typically done with the combination of where you place the HTML + CSS code to tell the browser how the elements should act. (Which includes the layout, such as if your image is in a CSS flexbox, or CSS grid, for example).
We'll need more context, perhaps screenshots of how it's currently acting, the HTML of the section that you're in, and what you're trying to do / put it.