Why won't this highlight?

Here is my code. Why won’t work highlight? Here is the code I’m using. Sorry, for some reason it doesn’t post all of the code in the thread. Don’t know why.

<style>

<body>

    .highlight {

        background-color: #blue;

    }

 </style>   

        <div class="google">

  <a class="fn org url" href="https://www.google.com/">Google</a>

  <div class="adr">

      <span class="highlight">Work</span>
.highlight {

    background-color: #blue;

}

Google

  <span class="highlight">Work</span>

I’m just going to post an image because it won’t work when I type the code in

remove the tag placed inside style tag, your code should look something like this:

<style>

  .highlight {
   background-color: blue;
   }
</style>

Thank you! But, does not body not go anywhere?

<!DOCTYPE html>

<html>

  <style>

    .highlight {

      background-color: blue;

    }

    </style>

  <body>

    <h2>Annoying Sound</h2>

    <main>

      <!-- THIS IS A COMMENT -->

      <p>Click here to hear an annoying sound</p>

      <audio id="annoyingSound" controls>

    </main>

  </body>

</html>

I have NO idea why I can’t get all my code on the thread, so I am sending a picture. Frustrating lol.
image

You’re missing the <head> tag

Likely if you’re trying to paste your code with html tags, the browser is probably translating them instead of showing them most likely. You need to use the </> button in the reply box bar to put all your code in code quotes to show in your reply.

I believe Style tags are supposed to go in the Head tags:

<html>

   <head>
      <style>
         Your style stuff here
      </style>
   </head>

<body>
   Your website stuff here
</body>

</html>
1 Like

Exactly what I’m trying to say

In the latest code you posted, there is no element with a highlight class on it.


I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.