Add variables to standard CSS stylesheets in ASP.NET(madskristensen.dk)

submitted by MHamiltonMHamilton(170) 4 years, 11 months ago

Great way to be more dynamic with your stylesheets. Allows for more flexible website layouts based on dyanmic information.

2 comments |category: |Views: 46

tags: another

new Add a live kick counter to your blog >> liveImage

You can even customize the image by choosing your own colors, and then clicking the button below to update the preview and the html code:

  • "Kick It" text
  • "Kick It" background
  • kick count text
  • kick count background
  • border

Simply copy and paste this HTML into your blog post.


Users who kicked this story:
Comments:

posted by offwhiteoffwhite(975) 4 years, 11 months ago 0

Interesting, but I really do not want to add scripting to CSS. The W3C worked very hard to cleanly separate structure, style and behavior into XHTML, CSS and Javascript in a way that allows them to work well with each other. You can already have Javascript instrument your XHTML and CSS. And with a library like jQuery you can do some amazing things with CSS selectors to adjust style and behavior. Instead of adjusting the CSS to add behavior I would instead emit dynamic Javascript with the settings it needs to alter the CSS as the page is being rendered. Also, I think combining multiple CSS fragments on the server is an excellent use of this CSS module. I always like to keep my CSS files organized but either you have to use one huge file or break it up into many files with many LINK references to them. It would be more efficient to place all of the CSS into a single file with a single LINK reference. And when pushing down this composite CSS file you could determine which fragments to include based on the browser at the other end. I personally would write all standard CSS with some small adjustments for browser specific fixes as needed. With the latest IE7 and FF such fixes are not as necessary as they were with IE6 which is going to be around a while longer.

Reply

posted by crpietschmanncrpietschmann(11.3k) 4 years, 11 months ago 0

This is awesome and adds a really nice level of server-side scriptability to CSS.

I did find one issue with it however, it caches the CSS output and doesn't take the UserAgent into account. So, what happens is the first time the CSS file is generated, it caches it and returns to any request after it. This is an issue when you adding scripting that varies the CSS output depending on the users browser.

Reply

information Login or create an account to comment on this story