How do I change the <p> text inside a class?

1k views Asked by At

Code I'm trying to change

I have tried the following code to change the p text without any success, I'm not sure how to call the p in order to change the text, how do I call this?

p.min-pariticipants  { 

font-weight: bold;
color: red;
font-size: 30px;

<p> Test </p>

}

1

There are 1 answers

0
MattHamer5 On

I'm not sure what you're actually trying to accomplish; but writing HTML inside CSS is a no go. If you're trying to change the contents of the p tag and you don't have access to the actual HTML; then you can use a small line JavaScript to accomplish this.

document.getElementById('test').innerText = "Change Me!"
<p id="test">Lorem Ipsum</p>

If you're looking to add additional content to the p tag, then you can use the CSS pseudo selectors ::after or ::before; this will put new content alongside the pre-existing one.

#test::after {
  content:' After'
}
#test::before {
  content:'Before '
}
<p id="test">Lorem Ipsum</p>