WordPress.org

Forums

CSS background image (2 posts)

  1. pattonyu
    Member
    Posted 7 years ago #

    I have image in background:
    http://www.rikovmlin.net

    background-image: url(images/pozadina.jpg);
    	background-repeat: no-repeat;
    	background-position: left 100px;
    	background-attachment: fixed;

    so, image is on the left, WP content is "center" and it looks different on every screen resolution.
    Is it possible to put background image on "center" minus 700px of horizontal (in order to ensure that the image will allways be on the left side of text, but near it?
    How to do the code?

  2. adamrice
    Member
    Posted 7 years ago #

    I'm guessing you're applying that background image to the body or a div that takes up the full width of the browser window.

    Instead, what might make more sense would be to apply it to a div that wraps around everything, but has fixed width and stays centered in the window. Something like this:

    In your template file:

    <body>
    <div id="wrapper">
    …

    In your css:

    #wrapper {
    margin: 100px auto;
    background-image: url(images/pozadina.jpg);
    background-repeat: no-repeat;
    background-position: left 100px;
    background-attachment: fixed;
    }

Topic Closed

This topic has been closed to new replies.

About this Topic