0

I am a beginner in PHP, Here is what I have written in PHP file:

<!DOCTYPE html>
<html>
<head>
    <title></title>
    <link rel="stylesheet" type="text/css" href="styles\style.css">
</head>
<body>
    <p id="sku">sku</p>


</body>
</html>

in HTML file I have written same code:

<!DOCTYPE html>
<html>
<head>
    <title></title>
    <link rel="stylesheet" type="text/css" href="styles\style.css">
</head>
<body>

    <p id="sku">sku</p>


</body>
</html>

then I styled both of them but got the different outcome, here is what I have written in style.css:

*{
    margin:0px;
    padding: 0px;
}
p{
    color: red;
}

problem is in the PHP tag is blue and in HTML it is red. Earlier I have tried many things and probably blue stayed but I don't know why.I used to change the style of PHP and it changed, but when I changed it once again it stuck on that style.

  • This code isn't the same. PHP has ` ` HTML doesn't – s3nzoM Jun 19 '20 at 07:36
  • Why you try to use PHP in an HTML file? If the file extention is .html PHP will not work – Baracuda078 Jun 19 '20 at 07:37
  • @s3nzoM I have edited the question.Code is the same. – Nikoloz Sakhvadze Jun 19 '20 at 07:38
  • @Baracuda078 I am trying to use HTML in PHP. I have written HTML code in HTML file and PHP file, why It shouldn't work? I think it is a buffer problem or something like that, but I don't know why – Nikoloz Sakhvadze Jun 19 '20 at 07:40
  • 1
    You're new to this. Then I have a tip. In your browser, right-click on the paragraph, and select _Inspect_ (or _Inspect element_, or whatever the equivalent is in your browser's language). A debugging window will open which will show you how styles are being applied to elements. You can probably work it out yourself from there :-) – Ben Hillier Jun 19 '20 at 08:11
  • What have you tried to debug the problem? Have you checked whether the CSS file could be loaded properly? – Nico Haase Jun 19 '20 at 08:11
  • @NicoHaase I have checked and it is not loading properly but I don't know why path is correct. Sometimes It works sometimes it doesn't – Nikoloz Sakhvadze Jun 19 '20 at 08:40
  • https://stackoverflow.com/questions/12717993/stylesheet-not-updating This question worked, I don't know how to edit, or say that this question is the same as the other one. please do that for me so that people with the same problem will be able to correct their code. – Nikoloz Sakhvadze Jun 19 '20 at 09:02

0 Answers0