Wednesday, December 19, 2007

Changing CSS having no effect!

In the week just gone by, I received a web app from one of my colleagues who was on medical leave. This was supposed to be a prototype of what I will be developing in the days to come. However, there were many issues with the UI of the site. The color scheme though looked good did not match with the logo of the company and had to be changed.

It took me some time to realize that the CSS file being used was one within the App_Themes folder and not the one outside. I had been making changes to the wrong file, hence the changes I was making were not reflecting. But hang on!! Now I was making changes to the correct file but still I could not see the changes reflecting in the front end. I double checked and was stumped. Just moments ago the changes made to the CSS were reflecting in the UI. What could be the possible reason now?

Somehow I had the feeling that I should refresh the page once(probably because of my experience with Service Desk Customization) and Bingo!!

Now I again I made some changes mainly changing the logo, but again it wasn't reflecting. I refreshed. Nothing!! Now what could be the reason? Thankfully I had a backup of the original CSS file. I compared that with the modified one. I realized what was happening. To work faster I was using the build style option in Visual Web Developer. When you use this a Window opens where you can visually set the CSS properties. I was using this to set the background image to the one I had created. The location of this image was "App_Themes/Theme1/Images/Image1.gif". So what was happening was the in the CSS the same url for the image was getting stored. But as my CSS file was already located at "App_Themes/Theme1/" the correct url for the image should have been "/Images/Image1.gif". I changed the Url and Voila!!

As I had posted earlier, Microsoft is always trying to simplify things by allowing you to code Visually. But this Visual coding style has pitfalls and is a sure source of many bugs in applications. My advice to all is "Be Extra Careful when writing code Visually!"

Cheers!!

1 comment:

  1. If you have simply tried to change the background of your Word Press site via the Word Press Background Dashboard and it's not practical, you should see how quickly your existing theme is already a background to set the background. Try again and again for attributes by uploading a new image or 1px solid color.
    Several times, the problem arises when you have the casing plugging used on your Word Press site. In fact, these plug-in for example, the W3 total cache start with CSS to make any changes to your site's CSS and do not take any effect. If you have such a plugin, you have to disable it, and then make changes
    Are you making CSS style changes via the Word Press Customizer to follow this website If yes, then you can forget to click on the Save button to save everything you add or change your site's CSS. Changes cannot be seen as long as you do not save the changes.
    Sometimes, that's true, the problems may be due to an incomplete understanding of CSS in the designer's page, but these columns are what's fixed (so send me those questions). Most often, however, the wrong browser itself has code, which makes the mincemeat what should be perfectly valid style.
    Furthermore, if you provide a URL to the problem page, the prospects for help get better. That way, people can see your page, see the problem of action, and review your HTML and CSS directly
    . If the alleged document is behind a corporate firewall, you move it to the public server; If not, please consider at least one of your style sheets in your post. The detailed explanation of the problem is no alternative to providing the source.
    By comparing, CSS is very easy to learn, it's a lot easier to specify. Besides, Opera and Explorer 5, and the much-anticipated output of Netscape 5, the CSS1 will almost certainly be a barrier for the latest look at standard compliant browsers, and much more powerful tool.

    ReplyDelete