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?
[MDN docs ]: css position https://developer.mozilla.org/en-US/docs/Web/CSS/position https://code.sololearn.com/WSr71E8C53IJ/?ref=app
You should reread the last lesson carefully.
Padding-right is for adding some specific inner-space to the right side of an element.
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.
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
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.
I still cannot understand. Why do we need the position attribute in this case?
Hasnain [ACTIVE CHALLENGER] Can you please explain more? I have read it several times.
Yasin Rahnaward Why do we need "padding-right" there?
Yasin Rahnaward Ok. Why do we need it there?