Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does '?' do in a Css link?

Tags:

css

I was browsing the html of my favorite site...ahem...and I saw this in the markup:

<link href="/Content/all.min.css?d=20090107" rel="stylesheet" type="text/css" /> 

what does "?d=20090107" do? I'm assuming it's a date of some kind, but I'm not sure why it's in the path to the file. Any ideas?

like image 974
Micah Avatar asked Jan 13 '09 12:01

Micah


People also ask

What does CSS link do?

Link is a connection from one web page to another web pages. CSS property can be used to style the links in various different ways. States of Link: Before discussing CSS properties, it is important to know the states of a link.

What is the selector for a link?

The :link selector is used to select unvisited links. Note: The :link selector does not style links you have already visited. Tip: Use the :visited selector to style links to visited pages, the :hover selector to style links when you mouse over them, and the :active selector to style links when you click on them.

What is visited in CSS?

The :visited CSS pseudo-class represents links that the user has already visited. For privacy reasons, the styles that can be modified using this selector are very limited.


1 Answers

That is there to add some uniqueness to the filename, so that when they change the CSS file, they can change the extra bit to be totally sure that every client will reload the CSS rather than use a cached version.

The webserver will ignore the parameter and serve /Content/all.min.css normally

Note: While it's possible the CSS is dynamically generated, this is a common idiom for ensuring a reload, and given the parameter is a date, it seems quite likely.


Edit: Podcast 38 mentioned this...

We’ve been using the Expires or Cache-Control Header since we launched. This saves the browser round-trips when getting infrequently changing items, such as images, javascript, or css. The downside is that, when you do actually change these files, you have to remember to change the filenames. A part of our build process now “tags” these files with a version number so we no longer have to remember to do this manually.

like image 156
Paul Dixon Avatar answered Sep 25 '22 06:09

Paul Dixon