Jaider
Jaider

Reputation: 14874

Generate Dynamic Css

I want to generate a Css that will be the same for all my items execept for especific thing like color or image... I wonder if I can do something like this:

<link rel="stylesheet" href="http://site.com/styles.aspx?id=123">

Just for testing I try something simple like this: ASPX:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm5ToCss.aspx.cs" Inherits="WebApplication1.WebForm5ToCss" EnableViewState="false" %>
.aaa
{
    color: red;
}

Code Behind:

public partial class WebForm5ToCss : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.ContentType = "text/plain";
//Get the ID, check database or files and change the style
        }
    }

but doesn't work for me. any ideas? What I am doing instead is separating the smallest part of css that is different by items from the big style. "like" skeleton pattern so I don't repeat myself. And maybe I continue doing that because of performance... but I want to know anyway how to do it in this other way.

Upvotes: 0

Views: 230

Answers (1)

Samantha Branham
Samantha Branham

Reputation: 7441

Not sure if this will fix it, but you should change your content type to "text/css".

Upvotes: 2

Related Questions