[thelist] CSS - background image keeps repeating

James Aylard webmaster at equilon-mrc.com
Fri May 11 17:30:22 CDT 2001


> i don't think 'fixed' is a valid attribute...
>
> > BODY { "a bunch of other stuff" ;
> >   background-color: #6600cc ;
> >   background-image: url(background_purplegradient1.gif) ;
> >   background-repeat: no-repeat fixed ;
> >   background-position: 0px 0px }

    "fixed" (without the quotes) *is* a valid attribute, but not for
background-repeat. It is a value for background-attachment, which does not
work in Netscape 4.x (neither does background-position, btw). Alternatively,
these values could all be trimmed down into a single "background" property
(I shortened the image file name for compactness):

background: #6600cc url(bg.gif) no-repeat fixed 0px 0px ;

    You could further reduce this by leaving off the two background-position
values (0px 0px) since upper left is the default position:

background: #6600cc url(bg.gif) no-repeat fixed ;

    When using the shorthand "background" property, the order of underlying
individual background properties is:

background-color background-image background-repeat background-attachment
background-position

    You may leave out any of them that you do not wish to set explicitly.
For full details, see the W3C CSS 2 recommendation [1].

James Aylard

1. http://www.w3.org/TR/REC-CSS2/, specifically
http://www.w3.org/TR/REC-CSS2/colors.html#q2





More information about the thelist mailing list