How to position image as shown in design file?

Hi, I wanted to know how it's possible to position my image as shown in the screenshot attached? Code: https://jsfiddle.net/x2dm3qen/7/
14 Replies
son arg
son argOP•3y ago
So that's how it looks like in the design ^
son arg
son argOP•3y ago
And here's mine:
son arg
son argOP•3y ago
You could see the purple doesn't not extend to outside of the screen
Kevin Powell
Kevin Powell•3y ago
Is the gradient diagonal bar it's own image, or part of the one with the girl in it?
son arg
son argOP•3y ago
It's with the girl yep I used grid there too
Kevin Powell
Kevin Powell•3y ago
In the real world, I'd ask the designer for separate assets, but I know this is from Frontend Mentor, so not really a choice 🙂 First thoughts would be to set a height (or min-height) on the image, so that it takes up the right amount of space vertically. It'll have to be pretty big, 'cause even right now it looks like the height might be 100%. Making that big enough will have the image get wider. Depending on how you set things up, this could have some other impacts as the image gets wider, but hopefully it just overflows outside it's parent without issue You'll also have to have an html { overflow-x: hidden; } since the image needs to overflow off the side of the page. If they were separate assets, I'd just position the diagonal thing with position absolute 😄
son arg
son argOP•3y ago
Oh okay, thanks! I'll try those out. Also, yep, from Frontend Mentor Yeah, true haha 😅
Soum
Soum•3y ago
Wow you got an answer straight from the KING himself! 👑 Tho @Alza i don't like to be that guy that points out every little thing but you've tagged this post wrong imo. It should only be CSS tag. Perhaps not HTML but definitely not semantic HTML
son arg
son argOP•3y ago
Oops, my bad then 😅
vert_Nk26☑
vert_Nk26☑•3y ago
how do i use two diff image one for desktop and one for mobile am done with the mobile but i don't know where to place the the desktop img i use mediaQ and the picture two both the desktop and the mobile
vert_Nk26☑
vert_Nk26☑•3y ago
Thanks in advance
croganm
croganm•3y ago
Are they set as CSS background images? Or are those img tags in the html?
vert_Nk26☑
vert_Nk26☑•3y ago
@croganm html tags
Kevin Powell
Kevin Powell•3y ago
Look into the picture element, it lets you set different sources for immerse with a media attribute Someone else asked about this earlier this week, so I'm covering it on my Short this week😅
Want results from more Discord servers?
Add your server