Centering a background image

  • Thread starter Thread starter Steve Easton
  • Start date Start date
You can use CSS to set it to a fixed position or no-repeat. For example:

<STYLE TYPE="text/css">
<!--
BODY {
background-image: url(images/background.gif);
background-repeat:no-repeat;
background-position:center center;
background-attachment:fixed;
}
-->
</STYLE>

You'll have to play with the CSS to get it the way you want it
 
Really having trouble with this!
I want the image centered to the max width of my content not
the whole page. You know, from the left edge of the left
sidebar to the right edge of the right sidebar.
I made the graphic so the edges shade into the next, so
making one big table for everything is not the answer, I
want that soft bleed going into the dead space.

Thanx!

RJ
 
Right idea, wrong tag though.

He would need to set up divs for his sidebars and content.
The content div would get the style you specified.

<style type="text/css"><!--
#right {}
#left {}
#main {
background-image: url(images/background.gif);
background-repeat:no-repeat;
background-position:center center;
background-attachment:fixed;
}
--></style>



: You can use CSS to set it to a fixed position or
no-repeat. For example:
:
: <STYLE TYPE="text/css">
: <!--
: BODY {
: background-image: url(images/background.gif);
: background-repeat:no-repeat;
: background-position:center center;
: background-attachment:fixed;
: }
: -->
: </STYLE>
:
: You'll have to play with the CSS to get it the way you
want it
:
:
:
: --
: David Berry
: FrontPage Support: http://www.frontpagemvps.com/
:
:
: : > Really having trouble with this!
: > I want the image centered to the max width of my content
not
: > the whole page. You know, from the left edge of the left
: > sidebar to the right edge of the right sidebar.
: > I made the graphic so the edges shade into the next, so
: > making one big table for everything is not the answer, I
: > want that soft bleed going into the dead space.
: >
: > Thanx!
: >
: > RJ
:
:
 
Thanks Mike. I must have missed the "content" part. There was another
question on background images (same principle) and I had that on my mind I
guess.
 
Back
Top