Skip to content
TheChatArchiveThe Chat Archive
gpt-3.5-turbo-0613· openaiHugging Face Suzhen/CodeChat

i want color red in that paragraph hi mory use html css js

  1. User

    i want color red in that paragraph hi mory use html css js

  2. Assistant

    To add the color red to a specific word in the paragraph using HTML, CSS, and JS, you can use the following code:

    HTML:

    <p id="paragraph">Hi Mory!</p>
    

    CSS:

    .red {
      color: red;
    }
    

    JavaScript:

    document.getElementById("paragraph").innerHTML = document.getElementById("paragraph").innerHTML.replace("Mory", "<span class='red'>Mory</span>");
    

    This code will find the word "Mory" in the paragraph and replace it with a span element having the class "red", which applies the red color style to it.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.