💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
style.css是每个WordPress主题所需的样式表(CSS)文件。 它控制网页的演示(视觉设计和布局)。 ## 位置 为了使WordPress将主题模板文件的集合识别为有效的主题,style.css文件需要位于主题的根目录中,而不是子目录。 有关如何将style.css文件包含在主题中的更详细说明,请参阅“[启动脚本和样式](themes/including-css-and-javascript.md)”的“样式表”部分。 ## 基本结构 WordPress使用style.css的标题注释部分在“外观(主题)”仪表板面板中显示有关主题的信息。 ### 示例 这是style.css的头部分的一个例子。 ``` /* Theme Name: Twenty Seventeen Theme URI: https://wordpress.org/themes/twentyseventeen/ Author: the WordPress team Author URI: https://wordpress.org/ Description: Twenty Seventeen brings your site to life with immersive featured images and subtle animations. With a focus on business sites, it features multiple sections on the front page as well as widgets, navigation and social menus, a logo, and more. Personalize its asymmetrical grid with a custom color scheme and showcase your multimedia content with post formats. Our default theme for 2017 works great in many languages, for any abilities, and on any device. Version: 1.0 License: GNU General Public License v2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html Text Domain: twentyseventeen Tags: one-column, two-columns, right-sidebar, flexible-header, accessibility-ready, custom-colors, custom-header, custom-menu, custom-logo, editor-style, featured-images, footer-widgets, post-formats, rtl-language-support, sticky-post, theme-options, threaded-comments, translation-ready This theme, like WordPress, is licensed under the GPL. Use it to make something cool, have fun, and share what you've learned with others. */ ``` 使用(*)表示的项目是WordPress主题库中的主题所必需的。 >[warning] 注意:WordPress主题存储库使用此文件中“版本”之后的数字来确定主题是否具有可用的新版本。 - Theme Name (*): 主题名称。 - Theme URI: 公共网页的URL,用户可以在其中找到有关该主题的更多信息。 - Author (*): 开发主题的个人或组织的名称。 建议使用主题作者的wordpress.org用户名。 - Author URI: 创作个人或组织的网址。 - Description (*): 简短描述的主题。 - Version (*): 该版本以X.X或X.X.X格式编写。 - License (*): 主题的协议。 - License URI (*): 主题许可证的URL。 - Text Domain (*): 用于文本域的字符串用于翻译。 - Tags: 允许用户使用标签过滤器查找主题的单词或短语。 标签的完整列表在“[主题评论手册](https://make.wordpress.org/themes/handbook/review/required/theme-tags/)”中。 在所需的标题部分之后,style.css可以包含常规CSS文件中的任何内容。 ## style.css中的子主题 如果您的主题是“子主题”,则在style.css标题中需要“模板”行。 ``` /* Theme Name: My Child Theme Template: Twenty Seventeen */ ``` 有关创建子主题的更多信息,请访问“[子主题](themes/child-themes.md)”页面。