-2

I'm making a website for a project and i've tried doing h1 { color: rgb(222, 222, 222,); } and it hasn't changed or anything

<html>
<head>
  <meta charset="utf-8">
  <style>
    h1 {
      color: rgb(222, 222, 222)
    }
  </style>
</head>
<body>
  <h1> Welcome </h1>
</body>
j08691
  • 204,283
  • 31
  • 260
  • 272
Icy
  • 1
  • 1

4 Answers4

1

The code supplied works as expected in a code snippet (the h1 text color is gray).

<html>

<head>
  <meta charset="utf-8">
  <style>
    h1 {
      color: rgb(222, 222, 222)
    }
  </style>
</head>

<body>
  <h1> Welcome </h1>
</body>

There is a missing semicolon on the CSS rule. Although this is optional on the last style in a CSS rule, it's good practice to use semicolons:

color: rgb(222, 222, 222);
terrymorse
  • 6,771
  • 1
  • 21
  • 27
  • It's not a good practice though but it will work https://stackoverflow.com/questions/11939595/leaving-out-the-last-semicolon-of-a-css-block – Ace May 07 '20 at 18:44
  • I tried that and put it into my index.html but it doesn't change my website at all and i put it into my readme.md and it show edit: im using github by the way so i don't know if that changes anything – Icy May 07 '20 at 18:46
  • 1
    @Icy Readme.md files use markdown format, not HTML. – terrymorse May 07 '20 at 19:30
  • @Icy What? That is not how github works. HTML does not influence the README. Put it into your readme.md and you should get raw HTML because Markdown is a different language than HTML. – new Q Open Wid May 10 '20 at 20:57
0

Clear cache in your browser, something code was cached

Encang Cutbray
  • 382
  • 1
  • 2
  • 9
0

It seems to me that you don't understand Github and are just learning. Your code works, but if you put it in the index.html, it doesn't have any effect on the README. And if you put it in README.md, it doesn't render because it uses Markdown and the HTML file uses a HTML interpreter. All of this is from the comments of another answer.

new Q Open Wid
  • 2,225
  • 2
  • 18
  • 34
-2

I think you might have forgot semi colons at the end of your code:

h1 { color: rgb(222, 222, 222) }

to

h1 { color: rgb(222, 222, 222); }