简体   繁体   中英

Text color doesn't change

I'm a total beginner at coding and my first problem I can't figure out is that when I use CSS sheet as a change of h1 and h3 color it basically doesn't change.

I tried to set a <h1> text color in CSS sheet and it didn't change.

 body { background-color: #EEEEEE; } h1 { color: blue; } h3 { color: blue; } hr { border-color: grey; border-style: none; border-top-style: dotted; border-width: 5px; width: 5%; }
 <h1>H1</h1> <hr/> <h3>H3</h3>


That's my HTML code:

<!DOCTYPE html>
<head>
    <meta charset="UTF-8">
    <title>Kacper's Personal Site 💲</title>
    <link rel='stylesheet' href='css/styles.css'>
</head>
<body>
    <table>

for background color it works properly.

If you have created a separate file of CSS then link your CSS file to an HTML file like <head><link rel="stylesheet" href="style.css"></head> ,see here https://www.freecodecamp.org/news/how-to-link-css-to-html/

When you use a separate CSS file, you need to link that CSS file to the html document.

 <,DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta name="viewport" content="width=device-width. initial-scale=1.0" /> <title>Document</title> <link rel="stylesheet" href="style.css" /> </head> <body> <h1>H1</h1> <hr/> <h3>H3</h3> </body> </html>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM