skip to Main Content

This is probably not what you think but I’m trying to make a “Welcome to _____” kind of thing. The way I want it to be is that “Welcome to” is in black and some of the name of the project is in green or something and the rest is black again. There is a bunch of stuff in HTML that I haven’t learned yet so there is probably a simple solution.

I tried using the code

<h1>Welcome to</h1> <h1>Name</h1>

But that just put it on a different line so I don’t know what to do.

2

Answers


  1. To achieve the desired effect of having "Welcome to" in black and the project name in a different color, you can use CSS (Cascading Style Sheets) to style the text. Here’s an example of how you can modify your HTML code:

    <style>
      .welcome-text {
        color: black;
      }
      
      .project-name {
        color: blue; /* You can change "blue" to any color you prefer */
      }
    </style>
    
    <h1><span class="welcome-text">Welcome to</span> <span class="project-name">Name</span></h1>
    

    In the code above, we have added CSS styles to two classes: .welcome-text and .project-name. The color property is set to black for .welcome-text and blue (you can change this to any color you like) for .project-name. By wrapping the text in tags and assigning them the respective classes, you can apply different styles to each part of the text.

    This will give you the desired effect of having "Welcome to" in black and the project name in a different color, all on the same line.

    Login or Signup to reply.
  2. You can use span in between the sentence and style it

    <h1>Welcome to <span style="color: someColor;">Name</span></h1>
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search