html - Background color for nested divs -
Is it possible that a child div does not inherit the background color of the parent div and instead the body tag's background?
Example:
& lt; Body & gt; & Lt; Div id = "main" & gt; & Lt; Div id = "sub" & gt; Some content & lt; / Div & gt; & Lt; / Div & gt; & Lt; / Body & gt; Body {background-image: url ("blah"); } # Men {background color: white; } Div all will always inherit the background color as white. But there is a way in CSS (around work) to specify that the sub should not be the heir of white ?? I have read that CSS does not allow this but is there any work for this?
What are you asking is that there is a background image on the body, there is a div in the body in which The color of a white background is
And then you want a div inside the div that looks through the background image? it's not possible.
There is a way to get what you want, theoretically you can give 'the view-through' the same background image as the body, and then reading the coordinates with jQuery Through (or if the div is always in one place, you can do it with CSS) You can position this background image so that it overlaps with the image of the body. In this way it will look like the internal divas work as a kind of window, whose effect you are watching.
jQuery method You assign the coordinates of the window code to position () , and then you can set background-position value: $ (function () {var Pos ($ '' 'window' );}); You can see it in action here:
Comments
Post a Comment