+1-888-365-2779
Try Now
More in this section

Forums / Designing with Sitefinity / CSS file instead of Themes

CSS file instead of Themes

5 posts, 0 answered
  1. Binu
    Binu avatar
    12 posts
    Registered:
    16 Mar 2009
    09 Oct 2009
    Link to this post
    Hi,
    Is there a way i can just use my css files directly in master pages so that entire site (all pages) can use it rather than creating a Theme from it.
    Thanks in advance for a quick reply.
    Binu
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    09 Oct 2009
    Link to this post
    Hi Binu,

    You can add link with href attribute to your css file

    <link href="~/style.css" rel="Stylesheet" type="text/css" />

    or add it programmatically

    HtmlLink link = new HtmlLink();
    link.Href = "~/CSS/Style.css";
    link.Attributes.Add(HtmlTextWriterAttribute.Rel.ToString(), "stylesheet");
    Page.Header.Controls.Add(link);


    Kind regards,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. Binu
    Binu avatar
    12 posts
    Registered:
    16 Mar 2009
    09 Oct 2009
    Link to this post
    Is there a way I can use simple html <link> tag (so that I can do conditional logic for ie 6.0/7.0 css) instead of runatserver?
  4. Binu
    Binu avatar
    12 posts
    Registered:
    16 Mar 2009
    09 Oct 2009
    Link to this post
    What you suggested works ! Thanks. Is there any disadvantages using CSS directly as opposed to Themes?
  5. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    12 Oct 2009
    Link to this post
    Hi Binu,

    It is better to add the css classes in your Theme css. If you are going to switch the css reference often you could create a control ( with the code I provided in my previous post) and drop it on your master page. Then use WebEditor( selector to your file system) and set link.Href attribute.

    Sincerely yours,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Register for webinar
5 posts, 0 answered