+ 1
Need Some Help With CSS
Hello. I cannot understand the CSS code in 38.2 CODE REPO inside the CSS course. I cannot understand the usage of position attribute there. Can you please help me?
10 odpowiedzi
+ 3
[MDN docs ]: css position
https://developer.mozilla.org/en-US/docs/Web/CSS/position
https://code.sololearn.com/WSr71E8C53IJ/?ref=app
+ 3
You should reread the last lesson carefully.
+ 3
Padding-right is for adding some specific inner-space to the right side of an element.
+ 2
Css positioning is a big topic, but for example we need to keep a website navigation or side bar in a stable state when scrolling the page, we have to set the header or side bar position to fixed or sticky Value [in order].
the fixed position is implemented in my first answer by blinovKirill code.
+ 2
Amin we use position to specify the position and behavior of an element as the page is being scrolled. For example we use position and give it a value of fixed accompanied with other properties like top, bottom, left and right so that the stays at the specified position all the time. You have other position values like sticky, relative and absolute. If you want to know what these values do just ask
+ 1
Amin we use padding to give space between the content and the boarder of the container. You can specify the direction if you want. Eg padding-left and so on.
0
I still cannot understand. Why do we need the position attribute in this case?
0
Hasnain [ACTIVE CHALLENGER] Can you please explain more? I have read it several times.
0
Yasin Rahnaward Why do we need "padding-right" there?
0
Yasin Rahnaward Ok. Why do we need it there?