dfgd
dfgd

Reputation: 455

background position: fixed

Hello I have a little problem with fixed background in CSS. I need to fix it to the left corner.

https://i.sstatic.net/Q5hhT.jpg

background: url('./images/coura.png') no-repeat fixed;
width: 451px;
height: 736px;
position: fixed;
background-attachment: left bottom;

Is there any way how to do it? Thank you for your answers!

Upvotes: 0

Views: 1962

Answers (3)

Solomon Sam
Solomon Sam

Reputation: 268

Another way is to set the background position to bottom left like this:

background: url('./images/coura.png') bottom left no-repeat fixed;

Upvotes: 0

Wex
Wex

Reputation: 15695

The most simple solution would be to set the image as the background-image for your body and set the background-attachment property to fixed:

html, body { height: 100%; }
body { background: url('./images/coura.png') 0 100% no-repeat fixed; }

http://jsfiddle.net/Wexcode/FEskF/

Upvotes: 0

Niet the Dark Absol
Niet the Dark Absol

Reputation: 324620

Your element needs to be where you want the background to be. Add left: 0px; bottom: 0px; to go with the fixed positioning.

Upvotes: 1

Related Questions