Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

body background color difficult to control

Status
Not open for further replies.

csr

Programmer
Jul 20, 2000
507
I am new to this xhtml stuff so this may be elementary but here goes anyway.

I am trying to adhere to STRICT xhtml 1.0 guidelines.

From everything I have observed, the way to assign the background color of the body of a document is through this method:

<body background-color: blue>blah blah blah</body>

I have also tried putting my desires into a style sheet.

Neither one seems to result in any color at all.

Any ideas ?


Don


 
Whoops ... I just read someone elses problem and INLINE style was the solution. It worked for me also.

<body style="background-color: blue"> worked !!

How do I put this into my style sheet ?

My present style sheet (which does not work) is shown below.

<style type="text/css">
body {background-color: blue}
h1 {background-color: #00ff00;text-align: center;font-family: arial}
h2 {background-color: transparent}
p {background-color: transparent}
pre {font-family: arial}
</style>



Don


 
I am trying to narrow this problem down to it's simplest element. Here is my HTML document followed by my CSS document. My <h1>...</h1> lines does not get centered.
I have no idea why.


HERE IS MY HTML DOCUMENT ...

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "<html xmlns=" lang="en" xml:lang="en">

<head>

<link rel="stylesheet" type="text/css" href="my_styles.css" />


<title>Home Finances</title>
</head>
<body>
<h1>F I N A N C E S</h1>
<p>This is a test of the body color.</p>
</body>
</html>



HERE IS MY STYLE SHEET .....

<style type="text/css">
h1 {text-align: center}
</style>



Don
 
In your stylesheet file, remove the
Code:
<style type="text/css">
and
Code:
</style>
lines.

Those are only needed when your styles are in your source file.

You might want to also include "width: 100%".

Ken
 
Bingo !
That had an immediate effect.


Now I can move forward.

Thanks

Don


 
the simplest way is just to put a style description inside the body tag itself...

<body style="background-color:#0000FF;">
</body>

no need for style sheets or anything...

you pretty much had it in your first post, but your syntax was a bit off :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top