Transferred from: http://www.bimeichun.com/Linux/emacs_html.html
Emacs defaults to provide us with a pattern for writing HTML files-Html-mode. This brings us a little convenience. Of course, you can also try Html-helper-mode with more powerful features.
1. Start
When we open an. html file, Emacs has automatically entered HTML mode, and you should see the HTML word displayed on the bottom status bar. You can also use the M-x html-mode if you do not have automatic access. Emacs provides us with a simple HTML template, c-c c-t html, and then enter the title return to call this template. M-x Html-autoview-mode (c-c c-s), you can open the browser browsing effect when Emacs saves the HTML document. But I prefer to open the Web page in the browser, save and press F5 to see the effect.
2. Hide and Show HTML tags
Sometimes, when we write HTML files, the entire window is highlighted, will you feel dizzy? To hide these tags is simple, html-mode inside only need c-c tab to hide these tags, when you want to display them, press c-c Tab again. Do not worry about the hidden tags will be accidentally deleted by us, when the cursor moved to the hidden marker location, Mini-buffer will be displayed.
3. Shortcut keys
p {margin-bottom:0.21cm;}
C-C c-f: The cursor moves to the next HTML tag at the current location.
C-c c-b: Moves the cursor to the previous HTML tag at the current location.
C-c <left>/<right>: Jumps to the beginning/end of the tab.
C-c DEL: Deletes the label. C-c 1~6: Insert title H1~h6.
C-C Enter: Insert paragraph mark <p>.
C-C/: Closes the B tag. For example, can be used in conjunction with the previous one, will automatically insert </p>.
C-c c-c H: Inserts a hyperlink tag.
C-c c-c N: Inserts a anchor (anchor) to facilitate jumping to that position elsewhere in the document.
You need to enter the anchor name in the Mini-buffer.
C-c c-c u: Insert unordered list marker <ul><li></ul>.
C-c c-c o: Insert ordered list marker <ol><li></ol>.
C-c c-c p: Insert marker <li>.
C-c c-c-: Insert horizontal line
C-c c-c I: Insert image reference marker .
C-c c-j: Insert line break <br>.
4. Special character input
Sometimes you need to display HTML tags in HTML text, such as <P>, and cannot be entered directly. You can do this: C-c c-n <, then enter P, then c-c c-n >;. In fact c-c C-n after the input characters are not parsed by HTML and directly output.
Html-mode Simple to use