Problems with text postion when using CSS

G

Guest

I have saved the following code in a CSS:

body {
color: white;
font-family: arial, helvetica, geneva, sans-serif;
background: black url(alice23.gif) no-repeat;
word-spacing: 1px;
position: relative;
top: 200px;
left: 165px;
width: 480px;
}


Unfortunately the text is displayed to the left on the page when it is
displayed instead of the specified position of top, left and width. This CSS
works in mozillia and firefox, but not IE. I am using IE6 w/SP2 on XP pro
w/SP2.

Does anyone know why this won’t work?
 
G

Guest

Per MSDN, the position attribute is not available for the BODY element. See:
http://msdn.microsoft.com/workshop/author/dhtml/reference/objects/body.asp

You could add an additional container element which produces similar results.

Here's an example.

<HTML>
<HEAD>
<STYLE>
BODY
{
color: white;
font-family: arial, helvetica, geneva, sans-serif;
background: black url(alice23.gif) no-repeat;
word-spacing: 1px;
}
#container
{
position: relative;
top: 200px;
left: 165px;
width: 480px;
background-color: red;
height: 100%;
}
</STYLE>
</HEAD>
<BODY>
<DIV id="container">
<P>Content</P>
</DIV>
</BODY>
<HTML>

Alex Scott [MSFT]

This posting is provided "AS IS" with no warranties, and confers no rights.
 
G

Guest

Another option is strict mode. Try adding the following line to the top of
your example.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN">

Alex Scott [MSFT]

This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top