---
title: "stylesheet"

doc_type: static
doc_category: static
doc_version: v20270301
source_url:
  html: 'https://developer.shopline.com/zh-hans-cn/docs/sline/tag/stylesheet'
  md: 'https://developer.shopline.com/zh-hans-cn/docs/sline/tag/stylesheet.md'
---

# stylesheet


    根据给定的 CSS 资源 URL 生成 `<link />` 标签。

    



```sline
{{#stylesheet url [preload=boolean] [media=string] /}}
```





    
## 必选参数

        
             `url` `string`：CSS 资源 URL。
        
    



    
## 可选参数

        
            - `preload` `boolean`：是否启用预加载。设为 `true` 时，会将该资源 URL 添加到 HTTP 的 `Link` 响应头中；设为 `false` 时则不添加。
        
            - `media` `string`：媒体查询条件，例如 `screen`、`print` 或 `(max-width: 600px)`。
        
    



    
## 例子

        
            

            为主题中的 CSS 文件生成样式表链接。

            

            
<SlineExample path={''} objects={ 
    [""] 
}>
```sline
{{#stylesheet "base/index.css" | asset_url() /}}
```
</SlineExample>
            
        
    
