Adrian Black
@thisfncodeioAll comments
- @Mahesh-yadav@thisfncodeio
Not sure what @ayoeix means by making the picture relative and position the controls absolutely to the picture, that would be some serious CSS voodoo. Because absolutely positioned elements can only be positioned to the closest PARENT element that also has a position set or be positioned relative to the body element. ('body' has a position of static by default)
You can, however, wrap the controls and the photo in a container div, then set the container to a position of relative and the controls to a position of absolute. This will remove the controls from the normal document flow and the container div will collapse to enclose the picture (ie. Only be as high and wide as the picture [there might be some extra whitespace and the bottom of the container that can easily be removed by setting the image to vertical-align: bottom]) you can then position the controls to hang halfway outside the container div. There's plenty of ways to do this, you can set the top position to 100% then translateX it back -50%. You can set the left position of the controls to whatever floats your boat.
The good thing about doing it this way is that the controls and the image are now one element (the container) and resizing the browser will have no effect on the controls therefore it won't jump around the page.
If you found this helpful, please give me a thumbs up. Thanks. Good Luck.
- @kawoody@thisfncodeio
Wow, this is nearly identical, Only thing I can see is that the first container with the logo needs a little more right padding than the mock, but besides that everthing looks good.
- @shylietara@thisfncodeio
Not exactly sure what white space you're referring to because I can't see any. Your solution is nearly spot on except for the fact that the component was supposed to be contained in the center of the screen whereas your design takes up the full screen, and the top half of the card, is supposed to be white. Other than that, it's great.
- P@kcde@thisfncodeio
First off, a great solution. Your solution does end up stretching the with of the entire screen which causes it to look off on widescreen devices. You could put a max-width on the container so it only stretches so far.
As for the purpose of pseudo-elements, they are exactly like regular elements except for the fact that they do not show up in the DOM therefore you cannot grab them with JS.