Entrance Events! Chat Gallery Search Everyone Wiki Login Register

Welcome, Guest. Please login or register. - Thinking of joining the forum??
May 10, 2025 - @896.09 (what is this?)
Activity rating: Four Stars Posts & Arts: 68/1k.beats Unread Topics | Unread Replies | My Stuff | Random Topic | Recent Posts Start New Topic  Submit Art
News: :4u: Love is not possession  :4u: Super News: Upload a banner!

+  MelonLand Forum
|-+  World Wild Web
| |-+  ✁ ∙ Web Crafting
| | |-+  ☔︎ ∙ I need Help!
| | | |-+  lining up clickable elements on a background


« previous next »
Pages: [1] Print
Author Topic: lining up clickable elements on a background  (Read 195 times)
candycanearter07
Hero Member ⚓︎
*****


i like slimes

⛺︎ My Room
SpaceHey: Friend Me!
StatusCafe: candycanearter
Itch.io: My Games
RSS: RSS

View Profile WWWArt

Goomy, I Choose You!Suck At Something September - Did It!uh oh! a pigeon got in!Artsy Candy CaneJoined 2024!
« on: November 01, 2024 @504.81 »

hi,

does anyone know how to "properly" line up clickable elements on a background in a way that it doesn't break on resize? the only things that I can think of would be to have each "clickable" thing in the image as a separate <img> tag and use like a div (which im not sure how to set up with having the background image also line up and not relying on stretch image scaling) or by using a map which completely breaks if your image can be scaled (which if its a fullscreen image it will)

so any advice here?
Logged

new to oldnet be nice




shortround
Newbie
*


⛺︎ My Room

View Profile

Joined 2024!
« Reply #1 on: November 02, 2024 @66.53 »

You can set the position and height of elements using percentages. If your parent element is, say, 400x300, and you say add another element that is 10% wide by 20% high, the child element will be 40x60. If you resize the parent element, the child element will maintain its size relative to the parent

If I'm not explaining it well, here's an example:

https://jsfiddle.net/ty94fnek/2/

The size and position of the <a> links are set as percentages (relative to the parent; the picture of the cat). In the second image, I've resized the cat, but the <a> links appear in the correct place and correct size, since the percentages are the same.

I am using absolute positioning for the <a> links, so the parent element needs to be position: relative as well.

Let me know if I'm not being clear
Logged
Pages: [1] Print 
« previous next »
 

Vaguely similar topics! (3)

What is your labor background?

Started by invader_gvimBoard ⚚ ∙ Life on Earth!

Replies: 6
Views: 330
Last post April 22, 2025 @194.54
by nintendowii99
JS question: setting new elements styles pragmatically vs with external css?

Started by candycanearter07Board ✁ ∙ Web Crafting

Replies: 3
Views: 296
Last post September 03, 2024 @94.73
by Rose
Any Good Background Pattern Makers?

Started by PainterFightBoard ♺ ∙ Web Crafting Materials

Replies: 4
Views: 951
Last post January 26, 2024 @166.37
by DiffydaDude

Melonking.Net © Always and ever was! SMF 2.0.19 | SMF © 2021 | Privacy Notice | ~ Send Feedback ~ Forum Guide | Rules | RSS | WAP | Mobile


MelonLand Badges and Other Melon Sites!

MelonLand Project! Visit the MelonLand Forum! Support the Forum
Visit Melonking.Net! Visit the Gif Gallery! Pixel Sea TamaNOTchi