Aquarius24 Aquarius24 - 5 months ago 15x
HTML Question

Hyperlink color not changing

I am trying to set colour of hyperlink to white in paragraph, but still it is not changing

<p style="color: rgb(255, 255, 255); a {color: rgb(255, 255, 255)};"><
Open Now <a href="http:mylink">Apply now!</a></p>


If you are going to use inline styles you should have it like this:

<p style="color: rgb(255, 255, 255); background: green;">
  Open Now <a href="http:mylink" style="background: black; color: rgb(255, 255, 255);">Apply now!</a>

Background color was added in the example for being able to see the hyperlinks.


Just to make it clear if it was not already you should avoid inline styles if possible. You should use Style Sheets in HTML documents

So the above example with a css file would be (style.css):

p {
  background: green;
  color: rgb(255,255,255);

a {
  background: black;
  color: rgb(255,255,255);

Then include your css file in the <head> of your document like this assuming you would call your css file style.css and it would be located in your project root (same level as index.html) in a folder named "css":

<!DOCTYPE html>
    <link href="css/style.css" rel="stylesheet" type="text/css">
      Open Now <a href="http:mylink">Apply now!</a>