Transparent background image

Hey, is this a semantic/efficient way to create an image that has decreased opacity with text on top? https://codepen.io/deerCabin/pen/vYQqrvV
14 Replies
vince
vinceā€¢11mo ago
Didn't you already do it in your codepen? Or are you looking for something better?
snxxwyy
snxxwyyā€¢11mo ago
yeah i was playing around with methods for it and was just wondering if there was anything better or if what i had was the best way
vince
vinceā€¢11mo ago
The way I do it is about the same but I'm curious too if there are better ways
snxxwyy
snxxwyyā€¢11mo ago
ah which way do you go about it? yeah most people have the section element have the background image and add the ::before pseudo element as a black box with a decreased opacity on top from what i've seen, i just tried to simplify it. just glad i didn't overcomplicate it and that it's valid šŸ˜…
vince
vinceā€¢11mo ago
Your way is better than the way I've been doing it haha The codepen I sent doesn't work šŸ˜… Oh that's why https://codepen.io/vince1444/pen/bGQPjNN
snxxwyy
snxxwyyā€¢11mo ago
ahhh it's the way i said šŸ˜… seems like we helped eachother here šŸ‘ always good
vince
vinceā€¢11mo ago
You want to use my way? šŸ«£ It's worse than yours More markup and css
snxxwyy
snxxwyyā€¢11mo ago
i meant we figured out mine was a good solution and it helped you improve yours šŸ˜…
vince
vinceā€¢11mo ago
Ohhh haha
snxxwyy
snxxwyyā€¢11mo ago
yeahh haha thank you
vince
vinceā€¢11mo ago
ofc šŸ™‚ šŸ‘ thank u too
snxxwyy
snxxwyyā€¢11mo ago
no worries šŸ‘ whilst we're here @vince, back on the topic of layouts šŸ˜…, for centering content exactly in a div, let's say for a full screen hero section, any of the methods from flex box justify content & align items to grid place content are all valid methods right? there's no one better than the other etc?
vince
vinceā€¢11mo ago
Ya it just depends on the content you want inside the section, flex and grid both work but sometimes one is better than the other Just comes down to experience and using them so I'd say just pick one and maybe the next time you implement something similar, you can try grid and see if it's easier Typically my rule though is that if you want your children to determine their own widths, use flex, but if you want your container to determine children widths, use grid
snxxwyy
snxxwyyā€¢11mo ago
ah gotcha, thank you šŸ‘
Want results from more Discord servers?
Add your server
More Posts