skip to Main Content

(Im using visual studio code) this is html

<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Title</title>
    <link rel="stylesheet" href="css/maincss">
</head>

<body>
    <h1>Title</h1>
    <p class="mainp">Paragraf</p>
  
</body>
 
</html> 

and this is css part

.mainp {
    color: aqua;
}

color in the website is not changing i also tried it with color does not change

p {
    color: aqua;
}

i want to change my font color but it is not changing

3

Answers


    1. Make sure your CSS

      .mainp {
      color: aqua;
      }

    is in a file named main.css in the folder css
    2. Change your css link to this

    <link rel="stylesheet" href="css/main.css">
    

    note the filename: main.css rather than maincss

    Login or Signup to reply.
  1. Make sure your CSS filepath is "css/main.css", maybe you forgot a period (typo)?

    Login or Signup to reply.
  2. In your html code, you have attached a wrong file , you have mentioned file as css/maincss , which should be main.css . Below is the correct code

    <!DOCTYPE html>
    <html>
    
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Title</title>
        <link rel="stylesheet" href="css/main.css">
    </head>
    
    <body>
        <h1>Title</h1>
        <p class="mainp">Paragraf</p>
      
    </body>
     
    </html> 
    

    Also make sure you have a file named as main.css inside css folder

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search