title: Serializing html and css, and storing in mysql
body: <p>I am in the process of developing an html template generator. I would like to store the templates in a mysql database (or text files if that would be more efficient). I am looking for the best way to serialize the html and css, and then reproduce the original efficiently.</p>
  
  <p>Javascript and php will be used to create/edit/and remove elements from both the browser and the database for later reproduction.</p>
  
  <p>Elements can be added such as div, p, a, etc. and nesting should not be an issue. The main problem I am having is if a div is nested within a div and a paragraph element is nested within the second div at a later time, how would all of this be stored in a database? Elements will be deleted and new elements will be added in random order.</p>
  
  <p>I hope this was somewhat clear. I am not really looking for code, but suggestions on how all of this would work together.  Any help would be greatly appreciated. Thanks in advance</p>