Re: 2 body tags using css

by "Tim Rivera" <lists(at)timrivera.com>

 Date:  Tue, 2 Sep 2003 21:47:06 -0400
 To:  "Diane" <diane(at)tein.net>,
"HTML Guild" <hwg-basics(at)hwg.org>
 References:  fwvcy01
  todo: View Thread, Original
> Is it possible using css to do a background that is a seamless background
> and then another one to go across the top of the page sort of like a
> heading?  It isn't working.  I can do this simply using images but wanted to
> learn how to do it using css if possible
> Thanks
> body, {
>   background-image: url(gold.jpg);
>   background-position: top;
>   background-repeat: repeat;
>
> body, {
>   background-image: url(black.jpg);
>   background-position: top;
>   background-repeat: repeat-x;
>    background-attachment: fixed;


Hello Diane,

First off, you have two errors. The comma after "body" and no closing brace.

What you are attempting will not work, because the second background
declaration for BODY will simply overrule the first one. What you can do is
enclose the page with a DIV, and give one of the background images to the DIV.
In the example below, I have removed unnecessary declarations; however, be
sure to always include a background color along with a background image. I
will sometimes also put a comment when closing a DIV to help keep track of
which DIV it is. This is usually helpful when using several DIVs, particularly
nested DIVs.


body {
  background-image: url(gold.jpg);
  }

div.body {
  background-image: url(black.jpg);
  background-repeat: repeat-x;
  }


<body>
<div class="body">

<p>All content here</p>

</div> <!-- body -->
</body>



Tim
____________________________________________________________
http://webdesign.meetup.com/     See you at the next meetup!
http://css.meetup.com/

HTML: hwg-basics mailing list archives, maintained by Webmasters @ IWA