Skip to content

CSS

一句话解释

CSS (Cascading 样式 Sheets) 是 language used 到样式 and lay out HTML 内容 on web page.

用大白话说

CSS controls how HTML looks. While HTML provides the structure, CSS decides the colors, fonts, spacing, layout, and responsive behavior. A single CSS rule can change the appearance of every matching element across an entire site.

CSS works by selecting elements (using selectors) and applying declarations (property-value pairs) to them. For example, p { 颜色: blue; } makes every paragraph's text blue. The "cascading" part means multiple rules can apply to the same element, and CSS has rules to decide which one wins.

Modern CSS is powerful: you can build complex layouts with Flexbox and Grid, animate elements, and adapt the design to different screen sizes with media queries. CSS is essential for making web pages look professional and feel usable.

示例

css
/* Select all <p> elements and style them */
p {
  color: #2563eb;
  font-size: 16px;
  line-height: 1.5;
}

/* Center a heading */
h1 {
  text-align: center;
}

这个 CSS 制作所有 paragraphs blue 使用 16px 字体, and centers 所有 <h1> headings.

相关术语

相关资源

相关课程

  • CSS

    学习 CSS selectors, 属性, and 布局

相关练习

相关项目

相关工具

解读错误信息

用大白话解释常见错误——什么意思、为什么发生、如何修复。

查看错误

← 返回术语表