Note that there are some explanatory texts on larger screens.

plurals
  1. POUsing a photo as a cover image only on part of the website
    primarykey
    data
    text
    <p>Im trying to add a background photo to a part of a website using css. I'd like to set the photo as "cover" to stretch and resize it as the browser from a visitor lets it to.</p> <p>The thing is, i'd like to split the website in 2 parts, #top and #bottom. Whereas the top half is about 79% and bottom 21%.The #top part will contain the "cover" photo, whereas the bottom half will have a certain background color.</p> <p>My problem is, that my current setup "sort of" works for IE (stretching is a bit off), but does not for Firefox and Chrome. I've tried many different things, but just can't get it right.</p> <p>The problem that occurs is, that in Firefox and Chrome the "cover" photo clips behind the bottom background, whereas in IE, the photo actually works as intended, and fills the #top part.</p> <pre class="lang-html prettyprint-override"><code>&lt;html&gt; &lt;head&gt; &lt;title&gt;Test&lt;/title&gt; &lt;style&gt; html { width:100%; height:100%; color:white; } body { height:100%; width:100%; } #top { background: url(PZwx1) no-repeat center center fixed; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../img/BV-site-bgfoto.jpg', sizingMethod='scale'); -ms-filter: "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../img/BV-site-bgfoto.jpg', sizingMethod='scale')"; height:79%; } #bottom {background: #F9525F;height:21%;}enter code here &lt;/style&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="top"&gt;&lt;/div&gt; &lt;div id="bottom"&gt;&lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>I've worked out the example here to; <a href="http://www.webdevout.net/test?02X" rel="nofollow">http://www.webdevout.net/test?02X</a></p> <p>Any help is much appreciated!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload