Which is better background fixed on a section : background attachment fixed (CSS) or img tag with position fixed? | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
0

Which is better background fixed on a section : background attachment fixed (CSS) or img tag with position fixed?

I want to know how are you doing a background fixed on a section element. I've tried this both options, but I want to see pros and cons and which one is better

13th Aug 2020, 4:02 AM
HĆ©ctor Mtz
HĆ©ctor Mtz - avatar
1 Resposta
0
Image tag fixed is a different thing, if you fix an image, being a different element or say section, it will stay their and other containers will flow beneath it. But when using background css property on a container, is generally used when you want an image as a background where you can add items on to it, without changing the position of the child elements.. and the container stays in the stack it doesn't come out of the flow. So when we use background attachement as fixed property, then the content scrolls and the background stays their as fixed
13th Aug 2020, 4:50 AM
ŠœŠ³. ŠšŠ½Š°ŠæšŸŒ 
ŠœŠ³. ŠšŠ½Š°ŠæšŸŒ  - avatar