PHP: why can't I reference css files? -Php Tutorial

Source: Internet
Author: User
I recently learned PHP and got stuck in chapter 3. I have referenced an HTML template, but this template cannot reference the css file. this is the HTML template: {code ...} however, I add: {code...} to the & amp; lt; style & amp; gt; label in the header ...} it works again. Passed review...

I recently learned PHP and got stuck in chapter 3. I have referenced an HTML template, but this template cannot reference the css file. this is the HTML template:

    <?php echo $page_title; ?>        
      
      

Your Website catchy slogan...

  • Home Page
  • Calculator
  • link three
  • link four
  • link five

However

Yes, it can work:

My project file structure:

Reply content:

I recently learned PHP and got stuck in chapter 3. I have referenced an HTML template, but this template cannot reference the css file. this is the HTML template:

    <?php echo $page_title; ?>        
      
      

Your Website catchy slogan...

  • Home Page
  • Calculator
  • link three
  • link four
  • link five

However

Yes, it can work:

My project file structure:

The relative path is wrong. change the path to your php reference and move the line of link down.

Css. you can see if it is a path problem.

Relative path

I think your template has two points, that is, the directory at the upper level.

The style label is a vertex.

By the way, use Link to reference this path../includes/style.cssOr not.

Why use PHP to reference css files? This is unscientific.

Css references are all used

In this form of =, you are the php include file, css does not need that

Is there a problem with the path? why did you introduce css in header.html?
It should be./style.css
Or ../includes/style.css.

Try to use the absolute path and change it to a relative one.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.