dcsimg
www.webdeveloper.com
Results 1 to 3 of 3

Thread: Link HTML code to page from external HTML page

Hybrid View

  1. #1
    Join Date
    Feb 2004
    Location
    Manchester UK
    Posts
    89

    Link HTML code to page from external HTML page

    On my site I all the webpages contain the exact same XHTML code and some css for a menu.

    Can someone please tell me is it possible to have an external HTML page with the code and a link?

    The way I mean is like linking a webpage to an external css stylesheet.

    This means that the page would open quicker and make the webpages a smaller file size and to save having all the same code on each webpage.

    All help much appreciated

  2. #2
    Join Date
    Aug 2012
    Posts
    155
    Yes, and this is how your site should be structured. Remove all your css and put into a file and save as style.css (you can name the stylesheet what you like and save it to the root of your site, as I am displaying here, or in a folder). Then, in your HTML page you link to the stylesheet in the head:
    HTML Code:
    <head>
    <!-- Other head code here -->
    <link href="style.css" rel="stylesheet" type="text/css" />
    </head>

  3. #3
    Join Date
    Sep 2008
    Location
    Dallas
    Posts
    154
    If I understand correctly, you're not looking for external CSS files (which should be external, as the poster above pointed out), but you have multiple pages that have the exact same code in them. The best way to do this is through PHP templates. You can have one PHP file with all the common HTML code in it, and just call that PHP file when you need the common code. You can then edit your PHP file, and the changes will reflect globally on all pages.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles