I'm building a demo page to compare styling options of page elements. Same page, identical UL each time, different styling rules... But with the same names for classes...
(Output from http://perfecticons.com works on fiddle! http://jsfiddle.net/4he2j52h/)
I'm stuck on the terms "separate context" just because I've used them before (^edited)
Question Is:
- What is it really called when you do that to CSS?
- Does it even exist?
I often can't solve a prob just because IDK what the right search terms are!
iframes do that, yep
That's what I'm doing but I've ended up attempting some amateurish framework for separation of something I'm not sure the name of using five different languages in ways they're sometimes deliberately designed to hinder!
The Question Is Still:
> What is it really called?
> Does it even exist?
For background, here's what I have:
(Really, this is just for background, in case someone wants to see code. The question is what's it called when you make one bit of a page separate from another as far as CSS is concerned)
pages/[integer]/index.php (the pages that get iframed)
pages/[integer]/stylesheet.css (styles generated by perfecticons.com)
fonts/[various font files, eot, svg, ttf & woff] (also from perfecticons)
index.php (main page)
fn.php (functions)
iconsHTML.php (included in the pages that get iframed)
stylesInIframes.css
stylesOnMainPage.css
Each of the index.php files that are to be iframed into main index, and the main index.php itself, all have fn.php included which has:
To get ready:
include 'path/to/config.php'; // config file with HTML opener() and closer()
define('PAGESPATH', 'pages/');
define('ICONSHTML', '../../iconsHTML.php');
Function to make main page:
function mainPage() {
$pages = glob(PAGESPATH . "[0-9]*", GLOB_ONLYDIR);
foreach ($pages as $p) {
echo '<iframe src="' . $p . '"></iframe>';
}
}
Function to make Demo pages:
function demoPage() {
/* === Get the CSS for *this* demo === */
$css = glob("*.css");
/* Headings / Warning */
if ($css[1]) { // There must be more than one stylesheet in there!
$heading = "You uploaded too many stylesheets!";
}else{
$heading = basename($css[0]);
}
/* Fix it so I don't need the fonts duped for each demo */
$css = file_get_contents($css[0]);
$needle = 'PATH_TO'; // path perfecticons.com put in generated CSS
$fontsPath = '../../socicon-font-files';
$css = str_replace($needle, $fontsPath, $css);
$css = '<style>' . $css . '</style>';
/* === Now put it on the page === */
opener('Social Network Icons Demos', 'basic');
echo '<link rel="stylesheet" type="text/css" href="../../stylesInIframes.php" />';
echo $css;
echo '<span>' . $heading . '</span>';
include ICONSHTML;
closer();
}