In my world (the Java/Servelet/JSP one), you have hit on something that everyone of us should be following. We know it as MVC... however the theory is the same and applicable to most websites:
Separate your web app into:
Data (data structure... DB/flat files/CMS)
Business logic (rendering engine, the actual application)
Presentation (rendered by the browser & CSS)
This kind of architecture is superb. For example, I have all of my data in a database, in XML. Depending upon who visits, determines how it is rendered. For example, I might chuck out XML if the user agent supports it, or HTML, or XHTML. I can also provide good fucntionality like exporting any bit of content to PDF (XML->PDF).
The 3 layered approach means that if I need to change presentation (in CSS) then I can just do that and not worry about data or logic. Also it's very useful for trying to comply with W3C guidelines. The last thing I wanted to do was start going through a few thousand JSPs trying to work out where horrible bits of code comes from.
In *theory* if I wanted to go from say... MySQL db to say Oracle, I can simply by mirroring the data structure and changing the common connection. Another great prospect - separation of your code can mean flexibility and scalability.
So in summary: I know this as MVC, however its theory can be (and should be) applied to all web apps.