-1

Sorry for the retro question, but I have to add two highlighted paragraphs of text (just a kind of "oldness warning") to a VERY old website (HTML4), and I can't seem to find out how to set text color and size as inline attributes in HTML4.

I tried all kind of attributes in the pand h2 tags (like <p color="#ff0000">also "text, "text-color" and others, but none of them worked.

I know all this for today's standards, but this is in HTML4. Is anyone old enough to remember? ;-)

Niet the Dark Absol
  • 320,036
  • 81
  • 464
  • 592
Johannes
  • 64,305
  • 18
  • 73
  • 130
  • As I wrote below, I had tried the style attribute at first and it didn't work. So obviously I had some kind of typing or syntax error when trying which I oversaw, hence my question here (and yes, I googled beforehand, but HTML4 stuff is not *that* easy to find in the big haystack). Anyway, thanks to the people who answered. – Johannes Apr 02 '16 at 15:50

3 Answers3

2

The style attribute was introduced in HTML 4, so you can use inline CSS.

style="color: #ff0000"

There is no, and never has been, a presentation attribute specifically for setting the foreground colour of a paragraph element. That was the job of the font element.

Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335
  • thanks once more! I had tried the style attribute first and it didn't work, but I obviously made some kind of typing or syntax error when trying which I didn't realize. – Johannes Apr 02 '16 at 13:12
0

This can be done in two ways:

  1. The HTML4 font tag.

  2. The CSS font-size and font-color properties.

1. The HTML4 font tag:

<p><font size="12" color="#ff0000">hello world</font></p>

2. The CSS font-size and font-color properties:

p {
  font-size: 180%;
  color: #ff0000;
}
<p>hello world</p>

Hope I could help

SK-the-Learner
  • 523
  • 5
  • 18
-1

Please check this out.

<p style="color:#ff0000; font-size:12px;">

you can check by reducing font site or can write like this for forcefully apply style in html element:

<p style="color:#ff0000; font-size:12px !important;">