I saw a css code where it was like
body { background: transparent url ('background.jpg') repeat scroll;}
What does the transparent value do? I tried google’ing about this, but no help. Wouldn’t background.jpg just override it?
Thank you.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
transparentis the color. An element can have both a background image and a background color.The above is equivalent to:
The color is important in general if e.g. the background image fails to load, or the image contains transparent regions, or the image does not repeat to fill the entire area (which is admittedly not the case in your example).
However, since
transparentis the “initial value”, it is never necessary when using thebackgroundshorthand, since the shorthand automatically sets all unspecified properties to their initial value.Thus, the only use case where
transparentmakes sense as a background color involves:background-colorproperty;An example would be