Web pages can be created by serving purely client-side code from scratch or they can be built using server-side code, then serving client-side code to the web browser.
Server-side code should always be hidden and should not be visible unless the Web Server was mis-configured.
Client-side code must be entirely visible which is one reason why very secure applications are rarely written as web browser applications.
But, you do have a way to "keep honest people honest" and maybe even protect from unknowlegeable websurfers. Although you cannot encrypt your pages to hide from the websurfer, you can obfuscate the code which in most cases makes it illegible to casual viewing but can be easily decoded.
Been awhile since I've played around with this... Here is a Javascript obfuscator
http://www.javascript-source.com/javascript-obfuscator.html
A commercial tool that will obfuscate the entire page
http://www.antssoft.com/htmlprotector
A Sourceforge PHP/HTML obfuscator (Public License)
http://sourceforge.net/projects/iddin
The reason why HTML page obfuscation can't be anywhere as strong as encryption is because your page must be readable by anyone generally without installing a custom plugin that could decrypt the page, so the algorithm for modifying the code on the page is widely known and available to all.