Solved

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

Posted on 2011-03-03
7
351 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Major Incident Management Communications

Major incidents and IT service outages cost companies millions. Often the solution to minimizing damage is automated communication. Find out more in our Major Incident Management Communications infographic.

 

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

Guide to Performance: Optimization & Monitoring

Nowadays, monitoring is a mixture of tools, systems, and codes—making it a very complex process. And with this complexity, comes variables for failure. Get DZone’s new Guide to Performance to learn how to proactively find these variables and solve them before a disruption occurs.

Question has a verified solution.

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

Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
When the s#!t hits the fan, you don’t have time to look up who’s on call, draft emails, call collaborators, or send text messages. An instant chat window is definitely the way to go, especially one like HipChat. HipChat is a true business app. An…
In this tutorial viewers will learn how to style rounded corners for elements in CSS using the border-radius property Begin with a normal styled element such as a div: To style all four corners of the div to be the same degree of roundness, use the …
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

751 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