typically the code is something like:
<html> <head> <style type="text/css"> body { font-size:12pt; font-family: Arial;} .... </style> <script type="text/javascript" src="jquery.1.3.2js"></script> <script type="text/javascript"> <!-- $(document).ready(function(){ ... }); ... --> </script> <meta ... /> </head> <body> <div> <p> .... </p> ... </div> .... </body> </html>
I like javascript-mode for the syntaxt highlighting and indenting. Likewise for sgml-mode for the HTML. Also I get auto-complete on the open tags. Css-mode is not so important so it's not so much a priority.
That's 3 disparate languages and 3 modes. Right now I've been swapping modes manually as I edit different sections. This works, sort of.
Anyone got a better approach?
JavaScript can also be used to load a CSS file in the HTML document.
Cascading Style Sheets (CSS) is a stylesheet language used to describe the presentation of a document written in HTML or XML (including XML dialects such as SVG, MathML or XHTML). CSS describes how elements should be rendered on screen, on paper, in speech, or on other media.
Ever since web-mode came to existence, I have gotten rid of mumamo and nxhtml. web-mode is easier to use and install. For a start, it uses different syntax highlighting and indentation of a mixed js/html/css file. But for me the really handy thing about it is that it works in other templating languages. Here's an example configuration from their website:
(require 'web-mode) (add-to-list 'auto-mode-alist '("\\.phtml\\'" . web-mode)) (add-to-list 'auto-mode-alist '("\\.tpl\\.php\\'" . web-mode)) (add-to-list 'auto-mode-alist '("\\.jsp\\'" . web-mode)) (add-to-list 'auto-mode-alist '("\\.as[cp]x\\'" . web-mode)) (add-to-list 'auto-mode-alist '("\\.erb\\'" . web-mode)) (add-to-list 'auto-mode-alist '("\\.mustache\\'" . web-mode)) (add-to-list 'auto-mode-alist '("\\.djhtml\\'" . web-mode))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With