Oh I see. Thanks a lot!
Hey I tried the codepen where you told me it works on my phone and the problems you showed me are still here for some reason can you tell me if it does it on your phone? I donāt get itā¦ lol
I think it is because of chrome.
looks good on my phone
Ok Iām confused I tried again and it is messed on my phone (chrome), on chrome (PC) and firefox (PC)ā¦
I am testing this page
getting the space again
Alright Iāll make another codepen and replace the link again weāll see I think I made a mistake on VS Code and fāed it up.
Ok so, here is an image Chrome (left) on PC vs Firefox (right) on PC:
I found what was wrecking me up. I just had to add right: 0; on #nav-ul for chrome for some reasonā¦
Do you know why?
Btw, I used this codePen: https://codepen.io/Tech_CA_Bro/pen/JxYOxN
-Tech
Thanks again for all the help! <3
no problem man
Its a great community to be part of
I agree very much man:)
So the reason the right: 0
had to be a thing on your #nav-ul
was because of the fact that itās absolutely positioned. By the MDN:
- An absolutely positioned element is an element whose computed
position
value isabsolute
orfixed
. Thetop
,right
,bottom
, andleft
properties specify offsets from the edges of the elementās containing block. (The containing block is the ancestor relative to which the element is positioned.) If the element has margins, they are added to the offset.
The key bit there is āā¦specify offsets from the edges of the elementās containing block.ā So, because the #nav-bar
is right-aligned and 25% width, then that is the containing block for this one. Without specifying a right value, it was assuming a left:0
within that #nav-bar
element.
Ohhhhh thanks a lot. Everything is clear but one thing, why did it need the line for chrome and firefox didnāt need it. I guess the default for firefox isnāt left: 0; but right: 0; ?
-Tech.
I suspect itās a matter of what the different browsers default to when no top/left are specified for absolutely positioned elements.
It seems this has been the subject of discussion, I googled differences between chrome and firefox rendering absolutely positioned elements
, and there were a LOT of hits. Notably this one from MDN.
Edit: In rereading that one, while it talks about the stacking order, it doesnāt really go into the differences per se. But, based on many many conversations over the years, when no positioning values (left/top/right/bottom) are provided, they seem to handle it differently.
Sweet. Shouldāve of thought of googling this. Didnāt think that would pay off XD! Thanks so much!
Hey Tech, nice work! This is so much better
However, the item product-*
seems off a little bit. Maybe you should find a way to make the image and texts of them aligned by each other somehow. I mean they should appear in the same horizontal positions.
Hey @tkhquang. Thanks a lot for everything you did for me! And yes you are right it is off a little so Iāll think of fixing it :). Iāve been focusing on web design for a week now and school also I lost a bit my motivation but I still have my CSS to pratice a lot :).