Solved

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

Posted on 2011-03-03
7
346 Views
Last Modified: 2012-05-11
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
Comment
Question by:mel200
  • 4
  • 2
7 Comments
 
LVL 9

Expert Comment

by:rawinnlnx9
ID: 35030062
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
 
LVL 12

Accepted Solution

by:
Chad Haney earned 500 total points
ID: 35031155
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
 

Author Comment

by:mel200
ID: 35031793
AHHHH! Of course!!
0
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 

Author Comment

by:mel200
ID: 35031901
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
 

Author Comment

by:mel200
ID: 35032002
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
 
LVL 12

Assisted Solution

by:Chad Haney
Chad Haney earned 500 total points
ID: 35032334
take out the space between url and (  ..........   url("/images/bg_l-r-body.gif");
0
 

Author Closing Comment

by:mel200
ID: 35032584
There you go!  I needed a refresher on the basics, thanks!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article discusses four methods for overlaying images in a container on a web page
Get to know the ins and outs of building a web-based ERP system for your enterprise. Development timeline, technology, and costs outlined.
This video teaches users how to migrate an existing Wordpress website to a new domain.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now