Home Events! Entrance Everyone Wiki Search Login Register

Welcome, Guest. Please login or register. - Thinking of joining the forum??
November 21, 2024 - @580.67 (what is this?)
Forum activity rating: Three Stars Posts: 38/1k.beats Unread Topics | Unread Replies | My Stuff | Random Topic | Recent Posts    Start New Topic
News: :dive: Are u having fun?? :dive:

+  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 50 times)
candycanearter07
Sr. Member ⚓︎
****


i like slimes

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

View Profile WWW

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)

Any Good Background Pattern Makers?

Started by PainterFightBoard ♺ ∙ Web Crafting Materials

Replies: 4
Views: 757
Last post January 26, 2024 @166.37
by DiffydaDude
Case Study - Design elements and hits, should we care?

Started by MelooonBoard ✁ ∙ Web Crafting

Replies: 3
Views: 1947
Last post April 22, 2022 @82.67
by Icey!
Accessibility toggle for elements?

Started by zjBoard ☔︎ ∙ I need Help!

Replies: 10
Views: 1132
Last post November 12, 2023 @597.26
by zj

Melonking.Net © Always and ever was! SMF 2.0.19 | SMF © 2021, Simple Machines | Terms and Policies 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