Overlaying half of a logo on top of an image
I'm trying to get half of the 'RixtMixt' logo to be on top of the first image, as seen in the design (1st image attached). My previous attempts resulted in the section overflowing, or there being some weird whitespace. The section needs to be 100vh. Here's the code (Astro & Tailwind):
<section
id="streetwear"
class="flex flex-col justify-between md:h-svh px-4 md:px-12 py-7"
>
<Logo outline={true} />
<div class="flex flex-wrap flex-col md:flex-row gap-4">
{
[
{
src: streetwear1,
alt: "Person wearing the '?!' socks and yellow Adidas shoes",
text: '?!',
},
{
src: streetwear2,
alt: "Person wearing the 'Shine' socks and lightblue Adidas shoes",
text: 'Shine',
},
{
src: streetwear3,
alt: "Person on a bike wearing the 'Sunny Side Up' socks and green Nike shoes",
text: 'Sunny side up',
},
].map(item => (
<div class="uppercase flex-1 text-orange">
<Image
src={item.src}
class="w-full md:w-auto object-cover"
alt={item.alt}
/>
<span>{item.text}</span>
</div>
))
}
</div>
</section>
13 Replies
It's a bit hard to test your specific case without a codepen but this should be what you're looking for
In your case it would probably be
You can do it with grid to avoid any responsive issues with position absolute. But if you don’t want to use grid you can just give the image gallery a negative margin top
Thanks! :) with this solution the padding is gone though, when I add it into the 'top' and 'left', the images and text are vertically overflowing
how would you do it with grid?
something like this
thank you so much, but when the screen is a little bit smaller you get this: would there be any way to fix that?
can you put it in a codepen please
https://codepen.io/thebugcoder/pen/EaYKGJr here you go
i replaced the images with placeholders
it's because your logo has a fixed height, if you turn on grid lines you'll notice that it doesn't entirely fill the container, try giving it a height of 100%. You might have to play around with the width and stuff though for that since it'll make it large in some instances
Its actually a good ol curse of the 100vh and not having a fraction or % to help fill it
also having the flex children (not really using wrap anyway when you swap it to column)
becaues flex will make children dense by default
grid-template-rows: auto 76px 1fr;
mostly fixes it but not sure what you are after fullyHm interesting, so because it doesn’t really have a definite size, items aren’t sized based off of the space in the container?
sorry not sure the question but I'm tired.
The spacing issue is because it needed 1fr to "push" the content up and auto to squish
so giving it a height is going to make things do auto things 🤷♂️
having the 1fr or a % will push the content.
Another option would be to set the first row to
max-content
then it does not care about the rest of the defined rows it will just be the size of its content.
I'm not sure if they intended to fill the 100vh (please use svh/lvh) with the 3 images though.ohh thx it works now 👍