Solved

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

Posted on 2011-03-03
7
344 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
Comment Utility
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
Comment Utility
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
Comment Utility
AHHHH! Of course!!
0
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 

Author Comment

by:mel200
Comment Utility
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
Comment Utility
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
Comment Utility
take out the space between url and (  ..........   url("/images/bg_l-r-body.gif");
0
 

Author Closing Comment

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

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

763 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

9 Experts available now in Live!

Get 1:1 Help Now