html - Can somebody tell me how I am using the class selector incorrectly? -
html file:
<html> <head> <link rel=“stylesheet” type=“text/css” href=“style.css” /> </head> <body> <p>red</p> </body> </html>
css file:
p { color: red; }
the word 'red' not change red text when open page in browser. if know why css file isn't linking html file appreciated. files in same directory.
the code have provided has no errors.
fiddle: https://jsfiddle.net/9n97lz69/
please copy & paste following code html file , verify works:
index.html:
<style> .menu p { color: red; } </style> <div class="menu"> <p>this sentence should red.</p> </div>
fiddle: https://jsfiddle.net/21umj65u/
then move css mystyle.css , verify works:
index.html:
<head> <link rel="stylesheet" type="text/css" href="mystyle.css"> </head> <div class="menu"> <p>this sentence should red.</p> </div>
mystyle.css:
.menu p { color: red; }
please check file location of mystyle.css
, verify against url in index.html
:
index.html:
<head> <link rel="stylesheet" type="text/css" href="mystyle.css"> </head>
Comments
Post a Comment