what is style.css?ver=1 tag?

前端 未结 6 2017
温柔的废话
温柔的废话 2020-12-15 06:26

I found out that some websites use css tag like style.css?ver=1. What is this?

What is purpose of ?ver=1?

How do I do it in code?

6条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-15 06:38

    To avoid caching of CSS.
    If the website updates their CSS they update the ver to a higher number, therefore browser is forced to get a new file and not use cached previous version.
    Otherwise a browser may get a new HTML code and old CSS and some elements of the website may look broken.

提交回复
热议问题