Can I change the color attribute of a Pre tag? My main objective is to write white text on a black background using Pre tag in HTML. So I set the bg-color as black, but now when I'm trying to use the Pre tag and write something, the color of the text also becomes black and I'm unable to see anything. Could u provide me with a solution so that i get the desired output without having to change the Pre tag and the bg-color. I tried using MS Word but it was in vain. It wont allow me to save the document with the appropriate file extension.
You can use CSS to style the pre tags. This would change the font color to white.
pre {
color: white;
}
Full Example:
CSS
pre {
color: white;
}
body {
background-color: black;
}
HTML
<html>
<body>
Test1
<pre>Pre</pre>
Test2
</body>
</html>