Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7690483
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T20:24:29+00:00 2026-05-31T20:24:29+00:00

I have an PHP/HTML main page, in which I include different other PHP files

  • 0

I have an PHP/HTML main page, in which I include different other PHP files (I include them within the body of the main page).

What if I want to include a CSS stylesheet into only ONE of the included file?

What if that included file is a PHP-only file? (that is, it doesn’t have those <head> tags, where the stylesheet reference is supposed to be)

What happens if I put “head” tags into a PHP file that is included in the body of the main page? I am wondering if putting head tags in the middle of the HTML body tags could cause problems at all, or at least with certain browsers.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T20:24:30+00:00Added an answer on May 31, 2026 at 8:24 pm

    Think of it this way, after all of you includes you still get one html file at the end of it. If you are including files in the body of your document, it should only contain tags that fit within the body, not html, head, title, body, etc. Your css file should be loaded in the of the main doc. Something like this

        <html>
    <head>
    <title>Title</title>
    <!--
    css and js here
    -->
    </head>
    <body>
    <!-- php include here ---->
    <div>content</div>
    </body>
    </html>
    

    So after your includes the html should still be valid. you can check that here http://validator.w3.org/

    EDIT:
    You can included as many css files as you want anywhere in the document but the overall structure should still be as above. But try to consolidate your css files as much as possible. Every external file is one more request the browser has to make, and can slow the load time if you have a lot.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's the deal - I have two files, main.html and processing.php. Within the php
I have written jQuery code, in files Main.html and ajax.php . The ajax.php file
I have a website which uses PHP and HTML pages, I want to create
i have main html page which have two frames frame1 and frame2. frame1 is
I have a problem in integrating PHP and JQuery: My main file is MyFile.html
I have to deploy my php/html/css/etc code to multiple servers and i am looking
I have a PHP page that returns a piece of HTML to set the
I have a php script (generator.php) which generates certain HTML/XML/SVG depending on various conditions.
Within my HTML, I have a php script that includes a file. At that
I've created a blog main page using PHP and have included a sidebar and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.