vendredi 12 août 2016

How to extract and HTML block with styles (INLINE)

This is more of a utility question, i'm trying to scrape html blocks along with their styles into android applications.

lets assume we have

<html>
  <head>
    <link src=""... css>
  </head>
  <body>
    ...
    <div id="hello-world">
    Hello World!
    </div>
    ...
  </body>
</html>

and lets assume the css is

#hello-world{
  color: red;  
}

Im trying to figure out a way or a tool to copy a certain block of html and it extracts automatically all of the applied styles into inline

where it becomes

<div id="hello-world" style="color: red;">
Hello World!
</div>

The reason im doing this, in Android we apply the styles of HTML inlined rather than being referenced by an external css file..

Css can be referenced but it does not make sense to refer all of the css of a single page just to get the styles of a specific block

Any ideas? thanks!




Aucun commentaire:

Enregistrer un commentaire