Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 356
  • Last Modified:

How can I do this properly with CSS? Body tag.

I have some old code on my site, and I want to replace it with proper CSS. But I've been laying with this and I'm getting a bad result. This works in the browsers I have, but is incorrect:

<body style="leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"" background="images/bg_l-r-body.gif" onload="MM_preloadImages('images/cart-2.png')" >

I have tried this:
CSS file:
{body: margin-left:0px; margin-top: 0px; background: url ("images/bg_l-r-body.gif");
}

then in the html document,
<body onload="MM_preloadImages('images/cart-2.png')" >

But I lose the background  image then.
0
mel200
Asked:
mel200
  • 4
  • 2
2 Solutions
 
rawinnlnx9Commented:
Your syntax is pretty poor.
--- try this
<body style="leftmargin: 0; topmargin:0; marginwidth: 0; marginheight:0;" background="images/bg_l-r-body.gif" onload="MM_preloadImages('images/cart-2.png')" >

Open in new window


I have tried this:
--- this is okay, what isn't it doing for you? Not knowing the image does it need to repeat? If so specify that.
CSS file:
{body: margin-left:0px; 
  margin-top: 0px; 
  background: url ("images/bg_l-r-body.gif");
}

Open in new window



then in the html document,
--- Do you have the javascript function for MM_preloadImages in your CSS somewhere?
<body onload="MM_preloadImages('images/cart-2.png')" >

Open in new window

0
 
Chad HaneyChief Technology OfficerCommented:
Your css syntax is off, the element/class/id goes before the braces
body{
 margin-left:0px;
 margin-top: 0px;
 background: url ("images/bg_l-r-body.gif");
}

Open in new window

0
 
mel200Author Commented:
AHHHH! Of course!!
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
mel200Author Commented:
Ok, I did this- in the html document, I only have
<head>head tags</head>
 <body> then the html
</body>

In the CSS file I have:
body{
 margin-left:0px;
 margin-top: 0px;
 background: url ("/images/bg_l-r-body.gif");
}

(On my test site I actually took everything else out of the css file and uploaded it).

But I am still missing the image bg_l-r-body.gif.

0
 
mel200Author Commented:
You can see it on my test site:

http://test dot magic kitchen  dot com slash how-to-start dot html

please use: userid:        visitor password:  mobi;39mobi
0
 
Chad HaneyChief Technology OfficerCommented:
take out the space between url and (  ..........   url("/images/bg_l-r-body.gif");
0
 
mel200Author Commented:
There you go!  I needed a refresher on the basics, thanks!
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now