Create this Layout

I am struggline to create this layout from a figma file. can anyone help out please?
No description
30 Replies
lko
lko2mo ago
What are you struggling with?
theseeker
theseekerOP2mo ago
I don't know how to position the image properly as it is in the design
lko
lko2mo ago
how is it right now?
theseeker
theseekerOP2mo ago
this is it in development
No description
lko
lko2mo ago
it seems pretty much the same, the onlydifference is that the green part in the design is wider
theseeker
theseekerOP2mo ago
it's mpt there are onlythree people showing the lady showing in dev is postioned to the right and somehow cut off
Jochem
Jochem2mo ago
without seeing your code, it's going to be hard to answer. Check out #how-to-ask-good-questions and put this somewhere so people can see it in their own browsers
theseeker
theseekerOP2mo ago
okay I will do thay
Carles
Carles2mo ago
Make the container display flex
theseeker
theseekerOP2mo ago
i did that
Carles
Carles2mo ago
Try making the flex-basis for the container on the left about 60%
theseeker
theseekerOP2mo ago
this is the figma file I am trying to work on. I am unable to share my code because I need to get a premium account on online editors
Jochem
Jochem2mo ago
you can use codepen and a placeholder image, or upload the image to imgur
theseeker
theseekerOP2mo ago
ok
snxxwyy
snxxwyy2mo ago
It’s because of the sizing of the green content. As I believe was already mentioned, you’d have to use a flex-basis to adjust that. If it’s still not quite right, you can tweak the image with background-position or object-position depending on if it’s a background image or an image element
theseeker
theseekerOP2mo ago
@Jochem I have uploaded the image to imgur and transferred the code to codepen.Above is the codepen link @Oladipo Sam-Charles @lko @snxxwyy you can check those links I shared. thanks a lot. CSS already giving me headache so I slept off
lko
lko2mo ago
I just added this:
.right-section img {
/* This is to make the image like in the design */
max-width: 100%;
object-fit: cover;
object-position: left;
}

.left-section {
/* This is a VERY wrong way to do things, but I don't have the design so I hardcoded the value, it only works for my screen */
flex-basis: 1000px;
}
.right-section img {
/* This is to make the image like in the design */
max-width: 100%;
object-fit: cover;
object-position: left;
}

.left-section {
/* This is a VERY wrong way to do things, but I don't have the design so I hardcoded the value, it only works for my screen */
flex-basis: 1000px;
}
lko
lko2mo ago
Well it looks like the left part is 807px wide, but in the website you can't say that the flex basis is 807px because it would suck, you have to find a way to make it responsive and still make it look good, I saw you used percentages, and i think that's a great solution
Jochem
Jochem2mo ago
This would also be the reason the image is wider than necessary in the design, so that the left can be a relatively fixed width while the right part has room to fill a wider gap making things pixel perfect should never be the goal because it's impossible the only thing you should focus on, in this case, is getting close-ish, and I think the main thing you want to do there is to get the image to stick to the left of its boundary, and have it cut off on the right rather than both sides
Jochem
Jochem2mo ago
like, if I take your codepen and set my browser's width to something less than full screen, it looks like this:
No description
Jochem
Jochem2mo ago
at full screen:
No description
Jochem
Jochem2mo ago
so it looks like it's working just fine?
lko
lko2mo ago
No the image was wider because he didnt set a max-width: 100% so it was overflowing, but yeah it would still be wider
theseeker
theseekerOP2mo ago
this is breaking my head right now. I feel like giviing up😴
Jochem
Jochem2mo ago
basically, in web development, you never make a site that will only ever be displayed on a 1920x1080 PC in Chrome at full screen. People might have a side bar open, or an older monitor, or be using their phone, or hate full screen layouts, or be using Edge which has a little toolbar on the right by default I think? Or be on a 1300 wide laptop, or a weird tablet, or the PS5 browser, or an ultrawide monitor or a fucking Samsung Smart Fridge. You design your stuff to look close to the target design, but getting it exactly right is impossible and pointless, because the second someone else looks at it, it'll be a little different. The most important thing is to make a site so that it looks decent on a wide range of devices and resolutions, and that means making sure that your design shrinks and grows along with the viewport. Your example in codepen does just that. It looks alright squished a little, and a lot more like the design, but then it still looks okay when I go full screen in my browser. The question of "how do I get this image to cut off exactly here" is answerable for sure: Just set a width on the right column of your design. But it's almost always the wrong question
ἔρως
ἔρως2mo ago
you forgot to mention that people also use different dpi settings, which can/will affect rem and em and all font-related units and that can also change the shape and size of elements, which can cause layout breaking situations for example, i use 125% font size on my work laptop, because 150% is too big and 100% is too small for a 15.6" 1080p display in fact, not even pixels are the same everywhere there's even non-square pixels oh, and on a crt (yes, people use it for the stupid high hz, no latency and nostalgy) you don't even have pixels and the viewport size of a mobile browser is a lie pixel perfect is a shiny myth made by clueless designers just get it looking kinda like you want and be happy it doesn't break if there's a scrollbar
theseeker
theseekerOP2mo ago
😭 😭 😭 😭 my head hurts right now
ἔρως
ἔρως2mo ago
donnt do pixel perfect: that's it i should say "don't try", but you do you
Want results from more Discord servers?
Add your server