Artifacts Gallery Guilds Search Wiki Login Register

Welcome, Guest. Please login or register. - Thinking of joining?
Autumn, 29 Nov 2026 - @3.24
Forum Activity: Three Stars ~ Boop! The forum will close in 997.beats! Random | Recent Posts | Guild Recents
News: :happy: Open the all windows! Your mind needs storms and air! :happy: Guild Events: Holiday Horror Watch-a-thon
Super News: ++ MelonJam 2026 ~ 1st Dec to 1st Jan! ++
+  MelonLand Forum
|-+  Da Web Revival
| |-+  ✁ ∙ Web Crafting
| | |-+  ☔︎ ∙ I need Help!
| | | |-+  How to get flexbox items to scale with resolution


« previous next »
Pages: [1] Print Embed
Author Topic: How to get flexbox items to scale with resolution  (Read 105 times)
KrazyKoen
Jr. Member ⚓︎
**
View Profile WWWArt


Honk Honk :o)
⛺︎ My Room
SpaceHey: Friend Me!
StatusCafe: @KrazyKoen
OS: Arch Linux

Guild Memberships:
Artifacts:
Visited on Melon's 10th Anniversary!NutcrackerJoined 2025!
« on: Autumn, 28 Nov 2026 @729 » Toggle Font Embed

I'm making this page with a scrolling line of houses contained in a flexbox and I'm struggling to keep the size and position consistent across resolutions. I'm a little rusty so I might be forgetting something obvious.

Relevant code:
Code
/*flexbox*/
      .Houses {
        display:flex;
        margin:0;
        flex-direction:right;
        bottom:16vh;
        position:absolute;
        flex:1 1 0;
        overflow:visible;
        transition:2s;
        left:0;
      }
/*flex item*/
      .House
      {
        min-width:21.5vw;
        max-width:21.5vw;
        min-height:41.6vh;
        max-height:41.6vh;
        border-style:solid;
        border-width:0;
        border-color:black;
        margin:1.5%;
      }

Logged

Dark forces loom over us...
Dan Q
Hero Member ⚓︎
*****
View Profile WWWArt


I have no idea what I am doing
⛺︎ My Room
RSS: RSS

Guild Memberships:
Artifacts:
The Worm is creeping around Melonland profiles!Caught by RubbereonThe Worm is creeping around Melonland profiles!Dan Q Cruisin'I DIDN'T meet Dan Q on Melonland!Visited on Melon's 10th Anniversary!
« Reply #1 on: Autumn, 28 Nov 2026 @782 » Toggle Font Embed

flex-direction:right; is meaningless; you probably want flex-direction:row;. But you don't need it; that's the default.

On to the actual problem:

It sounds like you're looking to resize the house images so that they're the same width as the <div>s that contain them? If so, this is probably what you're looking for:


Code
.House img {
  width: 100%;
}

That says: "every <img> inside something that has class 'House' should be exactly the same width as its container". You're already sizing the containers in a responsive way, so that's probably the special sauce you're looking for.

You might then need to do some other things to keep their aspect ratio right (giving each a width= and height= might be a start), and/or position them on the "ground", but it might be a start!

Logged

https://danq.me/_q26t/badges/dan-q-88x31-lighter.gif https://danq.me/_q26t/badges/dan-q-88x31-peekaboo-scroller.gif https://beige-buttons.danq.dev/beige-buttons-88x31.gif https://embed-html.danq.dev/embed-html-88x31.gif https://origami.danq.dev/88x31.gif https://skelly.monster/dem-bones-88x31.gif

Artifact Swap: Pink ham-ham rangerPolyamorousI met Dan Q on Melonland!shoeJoined 2025!cinnamoroll3 coins
mall-made manners
Casual Poster ⚓︎
*
View Profile WWWArt


in look for being edgy, I found only copying...
⛺︎ My Room
RSS: RSS

Guild Memberships:
Artifacts:
Moon Cheesepin - by mall-made mannersJoined 2026!
« Reply #2 on: Autumn, 28 Nov 2026 @785 » Embed


trying to inspect the elements...
after tinkering, i found out some ways:


Code
.House > img {
    min-width: 25%;
    max-width: 100%;
}


lower-class element in hierarchy, followed by selector/child by using class operator (">") (idk the real name of "it", i call it that now)

it works on my side - what about yours?



Logged

Quote
in look for being edgy, I found only copying...

Artifact Swap: Clippy just wanted to helpMelonalbum by newgeneMcmxcixfllorabeat time pin
KrazyKoen
Jr. Member ⚓︎
**
View Profile WWWArt


Honk Honk :o)
⛺︎ My Room
SpaceHey: Friend Me!
StatusCafe: @KrazyKoen
OS: Arch Linux

Guild Memberships:
Artifacts:
Visited on Melon's 10th Anniversary!NutcrackerJoined 2025!
« Reply #3 on: Autumn, 28 Nov 2026 @810 » Toggle Font Embed

it works on my side - what about yours?
Unless I'm missing something, it isn't working for me. Thank you so much for the help, though.

Logged

Dark forces loom over us...
KrazyKoen
Jr. Member ⚓︎
**
View Profile WWWArt


Honk Honk :o)
⛺︎ My Room
SpaceHey: Friend Me!
StatusCafe: @KrazyKoen
OS: Arch Linux

Guild Memberships:
Artifacts:
Visited on Melon's 10th Anniversary!NutcrackerJoined 2025!
« Reply #4 on: Autumn, 28 Nov 2026 @815 » Toggle Font Embed

flex-direction:right; is meaningless; you probably want flex-direction:row;. But you don't need it; that's the default.
firstly, thanks for catching this, that's a very embarrassing mistake. :drat:

Secondly, yeah, this worked. Thank you so much for the help :transport:


Logged

Dark forces loom over us...
mall-made manners
Casual Poster ⚓︎
*
View Profile WWWArt


in look for being edgy, I found only copying...
⛺︎ My Room
RSS: RSS

Guild Memberships:
Artifacts:
Moon Cheesepin - by mall-made mannersJoined 2026!
« Reply #5 on: Autumn, 28 Nov 2026 @822 » Embed

Unless I'm missing something, it isn't working for me. Thank you so much for the help, though.

no problem! it is weird, it might work in sandbox but not in reality; it happens more than person would think. tho, the code Dan made looks similar XD.




Logged

Quote
in look for being edgy, I found only copying...

Artifact Swap: Clippy just wanted to helpMelonalbum by newgeneMcmxcixfllorabeat time pin
Pages: [1] Print Embed 
« previous next »
 

Melonking.Net © Always and ever was! SMF © 2021 | Privacy Notice | Send Feedback | Supporters ♥ Guide | Rules | Whos a Mod? | 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
@000 Melon
Land
Forum Art Hub Chat Webring Explore Random Recent Tenement Arcade Want to Login or Join ? Web Craft Guide Graphic Catalogue Wiki Help I'm Lost! Link Land Newsletters Image Stream Minecraft: Online
Zap!
Passport Sites tamaNOTchi Asatte Add your site?
Aero Archive Onio Cafe 32 Bit Cafe Status Cafe