0

I have a header.php file that is called in all the pages. This header file contains a menu bar. The menu bar has been modified and the new item includes opening a pop-up div on click. This div reference a few css and javascript files. How can I add these files to the header considering I cannot have a head tag in the header.php file. The solution that has failed to work is:

<style>
<?php include '../../css/base.css'; ?>
</style>
4
  • If header.php is called in all the pages, then why don't you include that css in head tag. Commented Mar 5, 2015 at 6:52
  • Or you may copy your css in header.php Commented Mar 5, 2015 at 6:54
  • @SverriM.Olsen It did not have the css in the pop-up div. Commented Mar 5, 2015 at 7:52
  • @IrfanAhmed I cannot have a head tab in my header.php because this is called in all files that already have a head tag Commented Mar 5, 2015 at 7:53

2 Answers 2

1

Use this

<link rel="stylesheet" type="text/css" media="screen" href="../../css/base.css">
Sign up to request clarification or add additional context in comments.

Comments

1

Link to an external CSS and Javascript file, they don't need to be in the <head> section.

To add css use

<link rel="stylesheet" type="text/css" href="path/to/your/css/file">

To add javascript

 <script src="path/to/your/js/file"></script>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.