Why doesn't the text change color when I edit the css page?

ispiro picture ispiro · Apr 3, 2012 · Viewed 7.4k times · Source

I created a new web application in visual web developer. I saw that the title of "Site.Master" (in code) is:

<div class="title">
    <h1>
        My ASP.NET Application
    </h1>
</div>

So I opened "Site.css" and added:

h1
{
    font-size: 1.6em;
    padding-bottom: 0px;
    margin-bottom: 0px;
    color:Blue;
}

Showing "Default.aspx", though, doesn't show the text ("My ASP.NET Application ") in blue. Why?

EDIT: From the source code:

<body>
    <form runat="server">
    <div class="page">
        <div class="header">
            <div class="title">
                <h1>
                    My ASP.NET Application
                </h1>

So I added color: Blue; in the css under body, page, header, title, and h1. I rebuilt, and pressed Ctrl + F5. Doesn't help. I'm trying this in IE and Firefox.

Answer

Kyle Trauberman picture Kyle Trauberman · Apr 3, 2012

The stylesheet is probably cached on the browser. Clear your browser cache, and you should see the change.

Also, You probably did this for emphasis, but you don't need to surround the css in asterisks.

You can prevent this from occurring in the future by appending a query string to the css link:

<link rel="stylesheet" type="text/css" href='site.css?v=<%= DateTime.Now.Ticks %>' />

Something like this will cause the browser to download the css file every time the page is requested.