javascript - Is there a way to write styling within the body of HTML using PHP to *Move* it -


i wondering if there way write css styling within body, pull head tag using php.?

... not inline styling

... there way run php before html head tag parsed?

i assumed possible:

  1. write style in body:

    <body>   <div class="movecss">     <style type="text/css">       #frog       {       font-color: green;       }     </style>   </div> <p class="frog">frog's stereotypically documented being 'green' in colour, when in actual fact different depending on environmental habitat!</p> </body> 
  2. in head write similar this:

    <head>   <?php     function getelementsbyclassname(\domdocument $domdocument, $classname)     {       $elements = $domdocument->getelementsbytagname("movecss");       $matched = array();        for($i=0;$i<$elements->length;$i++)       {          if($elements->item($i)->attributes->getnameditem('class')->nodevalue == $classname)         {           $matched[]=$elements->item($i);         }       }       return $matched;     } ?> </head> 

    (snippet of php code reference: link page ...fyi: i'm sure variable names need start lowercase alphabetical char in php)

if possible, allow me write better css cms articles, avoiding requirement access css files , manually add custom entries. single class name of 'movecss' enforce written within 'movecss' div included in head. making work more malleable.

no, instead write css in original document , load javascript wherever required or write inline if css not complex.


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -