css query string

前端 未结 2 481
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-20 14:39

Is it possible to pass a query string into a style sheet and if so, can the css process it?

i.e. http://www.domain.com/css/somestyle.css?id=102992992

I notic

2条回答
  •  清酒与你
    2021-01-20 15:04

    Yes you can pass a querystring - no a plain CSS file can't use it.

    There are two reasons to do it:

    1. The css file is being dynamically generated
    2. For versioning, to make sure the browser always gets the latest version (the id could be the last-modified timestamp, for example)

提交回复
热议问题