ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

How can I use EE Tags within a stylesheet?

March 18, 2011 5:28pm

Subscribe [2]
  • #1 / Mar 18, 2011 5:28pm

    bgarrant

    356 posts

    I have a simple page and a stylesheet.  I am trying to setup my CSS to allow a different background based on the page.  Why will this not work?

    CSS from Stylesheet

    #bg_subs {
    {exp:channel:entries channel="pages" disable="categories|member_data|pagination" limit="1"}
    background-image: url({site_url}{header_image});
    {/exp:channel:entries}
    }

    Page Code

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html >
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    {exp:seo_lite use_last_segment="yes"}
    
    <link rel="stylesheet" type="text/css" media="all" href="{path=site/stylesheet}" />
    
    </head>
    
    <body>
  • #2 / Mar 22, 2011 2:16am

    Tyssen

    756 posts

    I never bother with EE tags inside CSS files; if I need to have page specific backgrounds, I just use inline style for the background on the element in the HTML.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases