Home > Development Tools > sublime > How to set up sublime to automatically complete html header information

How to set up sublime to automatically complete html header information

下次还敢
Release: 2024-04-03 14:45:19
Original
876 people have browsed it

In Sublime Text, you can automatically complete HTML header information by adding user code snippets. Specifically: character sets, headers, base URLs, stylesheets, and scripts.

How to set up sublime to automatically complete html header information

Settings for automatically completing HTML header information in Sublime Text

In Sublime Text, you can The following steps set up automatic completion of HTML header information:

1. Open the user settings file

  • Windows/Linux: Open the file -> Preferences-> Settings
  • Mac: Open Sublime Text -> Preferences-> Settings

##2. Add User Code Snippets

In the user settings file, find the

User Code Snippets section and add the following snippet:

<code>html_head:
  'html_head': {
    "scope": "text.html meta.head",
    "body":
'''
<meta charset="${1:utf-8}">
<title>${2:Untitled Document}</title>
<base href="${3:/}">
<link href="${4:styles.css}" rel="stylesheet">
<script src="${5:main.js}"></script>
'''
  }</code>
Copy after login

3. Save the settings file

Save and close the user settings file.

Usage:

Start typing

html_head in the HTML header area ( tag), Sublime Text will automatically complete the following information for you:

    Charset(charset)
  • Title(title)
  • Base URL(base)
  • Style sheet (link)
  • Script (script)
You can modify the default values ​​in the code snippet as needed.

The above is the detailed content of How to set up sublime to automatically complete html header information. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template