A bit late on this, but...
The code posted by Dheeraj would in fact not work as expected.
The
header function adds a header to the HTTP response, and has nothing to do with the HTML <header> tag.
And seeing as you put an echo call right before it, it would never even get executed.
(HTTP headers can't be manipulated once content is added to the response.)
Doing
header("Location: file.txt"); would not include a header into the current HTML source. It would redirect you to the "file.txt" file.
(Which I assume is not what you wanted to happen.)
I'm not entirely sure what you are doing with that "HTML_myweb" class, MyMarlboro, but it seems a bit to complex for this particular problem.
The solution is pretty simple, actually.
-
<!-- file: index.html -->
-
<html>
-
<head>
-
<style type="text/css">
-
.bnw {
-
background-color: #ffffff;
-
color: #000000;
-
}
-
.wnb {
-
background-color: #000000;
-
color: #ffffff;
-
}
-
</style>
-
</head>
-
<body>
-
<p class="bnw">Black text, white background</p>
-
<p class="wnb">White text, black background</p>
-
</body>
-
</html>
Or, if you prefer to put the CSS into an external file:
-
/* file: styles.css */
-
.bnw {
-
background-color: #ffffff;
-
color: #000000;
-
}
-
.wnb {
-
background-color: #000000;
-
color: #ffffff;
-
}
-
<!-- file: index.html -->
-
<html>
-
<head>
-
<link rel="stylesheet" href="styles.css" media="all">
-
</head>
-
<body>
-
<p class="bnw">Black text, white background</p>
-
<p class="wnb">White text, black background</p>
-
</body>
-
</html>
None of that has anything to do with PHP. It's just HTML and CSS.