Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what is style.css?ver=1 tag?

Tags:

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?

like image 328
Moon Avatar asked Oct 23 '09 16:10

Moon


People also ask

What are CSS tags?

What is CSS? CSS stands for Cascading Style Sheets. CSS describes how HTML elements are to be displayed on screen, paper, or in other media. CSS saves a lot of work. It can control the layout of multiple web pages all at once.

Why do we use style tag in CSS?

The <style> tag is used to define style information (CSS) for a document. Inside the <style> element you specify how HTML elements should render in a browser.

Which type of CSS uses style tag?

An inline CSS is used to apply a unique style to a single HTML element. An inline CSS uses the style attribute of an HTML element.


1 Answers

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.

like image 178
Michal M Avatar answered Oct 25 '22 11:10

Michal M