In my project, I have an index.html
file and a style.css
file. Currently, I am using inline CSS in my HTML file but now I want to utilize an external stylesheet. Inside my index.html file, just before the closing </head>
tag, I have added the following code:
<link rel="stylesheet" href="/style.css">
Within my style.css file, I have defined the background color of the body element as yellow:
body {
background-color: yellow;
}
Both of these files are stored in the public_html
directory. However, when I open the index.html file, the background remains white rather than changing to yellow.
How can I successfully link the style.css
file to the index.html
file?