We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 17717
    • 433 Posts
    Hi all,

    I have just installed Modx, very nice looking too. I have used various OS CMS’ in the last couple of years. I went searching for a new one because I wanted something more user friendly for the client. Wow... got so so much more with modxcms. All new sites I will be developing in modx from now on.

    Anyway, on to my question, one of those newbie questions that I will look back in a few month and cringe. I have created a new template, went into the site via ftp and looked for a place to add my CSS, couldn’t find it? Is it stored in the database???? Is it not a case of simply linking to it on the server?

    Thanks all.
      http://www.blend.uk.com | Web Design by Blend
      • 6726
      • 7,075 Posts
      You can find your default template’s CSS in assets/templates/default/site.css smiley
      otherwise (if you’ve created your own template), you’ll find it in assets/templates/my_template_name/my_css_name.css
      ...or wherever you choose to place your css, it’s a question of method there.

      Your MODx template is just like any web page using CSS for styling, you have a link to your stylesheet (the following is the default template’s code) :

      <link rel="stylesheet" href="[(base_url)]assets/templates/default/site.css" type="text/css" media="screen" />


      or it could be

      <style type="text/css" media="screen">
        @import url(path_to_my/stylesheet.css);
      </style>
      


      if you use the @import rule.

      Your CSS is only stored in the database if you use the CSS as document (also see this) method, but that’s another method entirely, which I wouldn’t recommend for a newbie tongue
        .: COO - Commerce Guys - Community Driven Innovation :.


        MODx est l&#39;outil id
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        I’ve started putting my css in a chunk and putting the chunk in my template head. I’m finding several advantages to this; the main one that I can uses snippets and TVs in my css. With the CSS as a document, you can use snippets but not TVs, since the TV won’t be assigned to any template (the CSS document doesn’t have one), and even if you do give the CSS document a template and assign your TV to it the TV’s value won’t appy to your actual web page, only to the CSS document! I have used a TV in the CSS when I wanted the background color as well as H1/H2 and various borders to be different colors for different sections of the site; using @INHERIT bindings made it easy.

        It also makes for a bigger final HTML document, but on the other hand an external file has to be requested and uploaded, then applied to your HTML document, so it’s actually reducing bandwidth a bit since you’re not making a whole new request. As far as "separation" goes, in developement it’s still completely separated.
          Studying MODX in the desert - http://sottwell.com
          Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
          Join the Slack Community - http://modx.org
          • 6726
          • 7,075 Posts
          Very interresting Susan ! Now there is a third method smiley
          Being able to use TVs in CSS sure is a plus !

          I am not sure I will go down this road unless I really need it though, I like to have my CSS separate from the template, even though with a chunk it won’t impede the template’s readability.
            .: COO - Commerce Guys - Community Driven Innovation :.


            MODx est l&#39;outil id
            • 17717
            • 433 Posts
            I’m getting there folks. I will post in the site showcase when I have finished smiley

            Thanks
            Lee
              http://www.blend.uk.com | Web Design by Blend