Home > Net >  Why can't i change the button color with css?
Why can't i change the button color with css?

Time:06-28

When i call the css, the button doesn't change to the right color nor to the right position. What am I doing wrong please?

.btn {
  position: absolute;
  top: 30%;
  background-color: #00e70c;
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 18px;
}

.box {
  margin: 20px;
}
<!DOCTYPE html>
<html lang="en">


<head>
  <link rel="stylesheet" href="static\style.css">
</head>



<body>
  <button >Click me!
    </button>


</body>

</html>

CodePudding user response:

You are in right way. In your code there is no issue. Result is responding as your code have to display. You added margin to (.box class) that is not added to your html but there is only CSS so that one is not reflecting to page. So there is no error or nothing any issue in your code. code is display the result as per your code.

CodePudding user response:

If you are using firefox, problem could be you are using backslash \ instead of slash / in your href

Else :

Go to dev tool panel of your browser (usually F12 key) > Network > check the checkbox called "Disable cache", then refresh.

Else :

Check if your stylesheet is in the right folder and if the path to it is correct.

  • Related