Home > Development Tools > sublime > body text

How to create css in sublime

下次还敢
Release: 2024-04-03 07:33:13
Original
582 people have browsed it

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>
Copy after login
  • For example, the following rule sets the text element to red:
<code>p {
  color: red;
}</code>
Copy after login

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>
Copy after login

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

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

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!

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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!