How to connect css style in php file?
In the header connected, but in another file - does not work. There is a header.php file in which css connected, it works ok.

 <head> <link rel="stylesheet" href="style.css" type = "text/css"> <meta charset="utf-8"> </head> 

And there is a file file1.php , in which include header.php :

 <?php include("header.php"); ?> 

In the file1.php css style is called:

 <ul class="first"> <li>Строка 1</li> </ul> 

But on the site it is not displayed. What should be added to the code?


I have all the files in the same folder for now, for simplicity.

  • Can show html which generates php script file1.php - Evgeny Gavrilov
  • 2
    check file paths - Necro The Human
  • <? php include ("header.php"); ?> <ul class = "first"> <li> Test text </ li> </ ul> <? php include ("footer.php"); ?> - Julia

2 answers 2

Most likely you specify the path to the style relative to header.php , and you need to specify the path relative to file1.php .

  • I put them in one folder for simplicity)) there are no paths in the file name. - Julia
  • Did you run the local server? - kizoso
  • Yes, I upload files to the hosting and then check the site. - Julia
  • If you still have this problem, add more information, such as a screen architecture. - kizoso
 echo "&lt;link rel=\"stylesheet\" href=\"style.css\" type=\"text/css\">"