I have this html text on many pages
<head>
<meta charset="utf-8" name="viewport" content="width=device-width, height=device-height minimum-scale=1, maximum-scale=1">
<title>Account</title>
<link href="css/Master.css" rel="stylesheet"/>
<link rel='stylesheet' media='screen and (max-width: 450px)' href='css/narrow.css' />
<link rel='stylesheet' media='screen and (min-width: 451px) and (max-width: 800)' href='css/medium.css' />
<link rel='stylesheet' media='screen and (min-width: 801px)' href='css/wide.css' />
</head>
The problem is that I want to use this same code for many pages without having to copy and paste over let's say 5 pages. Is there a clever way to use an "include" command for this?
You can write a file with this:
File with libs
<meta charset='utf-8' name='viewport' content='width=device-width, height=device-height minimum-scale=1, maximum-scale=1'>
<title>Account</title>
<link href='css/Master.css' rel='stylesheet'/>
<link rel='stylesheet' media='screen and (max-width: 450px)' href='css/narrow.css' />
<link rel='stylesheet' media='screen and (min-width: 451px) and (max-width: 800)' href='css/medium.css' />
<link rel='stylesheet' media='screen and (min-width: 801px)' href='css/wide.css' />
HTML
<head>
<?php include("file_with_libs.php"); ?>
</head>
But I advise you that use a template engine like Twig. You have all information in: http://twig.sensiolabs.org/
Or You can see other reply that i wrote, explaining how to use Twig: Best practices to create a Twig HTML Layout (Masterpage)
If you are using php you can make a new file page-element.php and paste your content in that file.
Then in every page where you want to use this element you can use
<?php
include_once "page-element.php";
Check if your server is configured to use server side includes. That may be an easy way to achieve what you want without needing PHP.
I am making a bit of an assumption that you are using Apache, which I accept may be incorrect but IIS and Ngnix both provide SSI functionality, though I am not sure how similar they are to Apache's.