Home >Development Tools >sublime >How to create css in sublime

How to create css in sublime

下次还敢
下次还敢Original
2024-04-03 07:33:13656browse

The steps to create a CSS file in Sublime Text include: 1. Create a new file; 2. Save the file and add the .css extension; 3. Add a CSS rule (selector {property: value}); 4 . Save and test (link CSS files to HTML).

How to create css in sublime

How to create CSS in Sublime Text

Sublime Text is a popular text editor for coding and mark. Here are the steps to create a CSS file:

1. Create a new file

  • Open Sublime Text.
  • Go to File >New File.

2. Save the file

  • Save the file and extend it to .css. For example, style.css.

3. Add CSS Rules

  • To write CSS rules, type the following syntax in the file:
<code>选择器 {
  属性: 值;
}</code>
  • For example, the following rule sets the text element to red:
<code>p {
  color: red;
}</code>

Tip:

  • The selector can be an element, a class , ID or combination.
  • Property specifies the CSS property to be changed.
  • value specifies the new value of the attribute.

4. Save and test

  • Save the CSS file.
  • Link the CSS file into the HTML file where you want to apply the style.
  • Open the HTML file in a browser to view the styles.

Example:

Create a CSS file named style.css with the following rules:

<code>body {
  background-color: #f0f0f0;
}

h1 {
  color: #000000;
  font-size: 24px;
}</code>

Then, link to the CSS file in the HTML file:

<code><link rel="stylesheet" href="style.css"></code>

The above is the detailed content of How to create css in sublime. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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