How to choose the color of the words?

Question:

how to choose the color of the words
Repl link:

code snippet

In future, please link your repl and be more clear about what you want.
https://html.edu4rdo2008.repl.co/
First of all, a HTML file, for compatibility and accessibility, should always have this boilerplate at the start:

<!DOCTYPE html>
<meta charset=utf-8>
<meta name=viewport content="width=device-width">
<title>the night is over</title>
<html lang=en>

Use CSS.

2 Likes

Hey @edu4rdo2008! Welcome to the community!

You can use CSS to change the text of your webpage. Here’s is a step by step guide on how you can do so:

  1. Create a CSS file in the same folder as your HTML file. I have decided to name it style.css.
    image

  2. Copy this code below

.colored {
    color: red;
}

The .colored represents a CSS class that you can use on HTML elements.
color: red means to set the color of main component of your element to red.

  1. Link the CSS file to your HTML file. It’s recommended to do it in the <head>.
<head>
    <!-- … -->
    <link rel="stylesheet" href="style.css">
</head>

The rel attribute tells the computer what you are linking and the href tells where the source file is.

  1. Add an element with the .colored class in your <body> element, preferably using the <p> element to see the effects easily.
<body>
    <p class="colored">I am RED???</p>
</body>

You should be able to see the red text in your website.

A more in-depth guide on CSS has been posted by @UMARismyname. You can check it out if you want.

Hope this helps!

2 Likes

@edu4rdo2008

So assuming you want to choose a good color theme, what programming language are you refering to? Or do you want to find a color theme in general?

In other words can you be more specific?

1 Like

Use css!

  • click “+”
  • type style.css
  • press enter
  • add a class to your element in the index.html file, example:

    My Paragraph!

  • in the style.css file type
.any-name {
  color:red;
}

I hope you find this helpful, any questions? Comment on this repl: replit.com/@ChickenG1ttrDev/ChickenG1ttrDev

Shouldn’t that go in the head?

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width">
    <title>Document</title>
</head>

<body>
    <h1>Hello, world!</h1>
</body>

</html>
3 Likes

You don’t need head and body tags as long as you put the head stuff before the content of the document.

1 Like

Okay, but head and body makes HTML so much more readable.

1 Like