Home > Article > Web Front-end > Reasons why CSS files externally referenced by HTML do not take effect
The reasons why the HTML external reference CSS file does not take effect: 1. There is no associated external CSS style sheet file or the associated path is wrong; 2. The encoding of the style sheet saved is wrong. You can save the css file in utf-8 encoding. Just click the file.
The operating environment of this tutorial: windows7 system, HTML5&&CSS3 version, Dell G3 computer.
Recommended: css video tutorial
The reasons why HTML external reference CSS files do not take effect
1. External CSS is not associated There is an error in the style sheet file or associated path
This is an error that makes people speechless, but I have encountered it before. After working hard to write the code, I found that none of the styles took effect, and I was busy working stupidly. After a long time, I finally found that I forgot to associate the external style or the path was wrong. My mood at that time was really. .
If all your styles do not take effect, first confirm whether the style sheet is associated, or whether the position and name of the associated style are correct
<link rel="stylesheet" href="css/index.css"/>
2. The encoding of the style sheet saved is wrong
If you suspect that the encoding of the CSS table is wrong, you can directly save the css file as a file in utf-8 encoding.
The above is the detailed content of Reasons why CSS files externally referenced by HTML do not take effect. For more information, please follow other related articles on the PHP Chinese website!