6 Replies Latest reply on Aug 30, 2007 3:35 PM by nidhi_hs

    CMS - How to include css file ?

    nidhi_hs

      Hi

      Environment - Jboss portal 2.6.

      I uploaded a html file using the CMS Administration tool. The html includes a css file in it. The include code is

      <link rel="stylesheet" href="docs/css/main.css" type="text/css" />
      


      I have the main.css under docs/main folder.

      Including like this is not working. When I edit the uploaded file within the CMS Administration I noticed that the above mentioned code is not present.

      Is there a different way of including CSS ?. Please help

      Thanks
      Nidhi



        • 1. Re: CMS - How to include css file ?
          peterj

          Did you place the html file in the base folder in CMS, or did you place it into a subfolder?

          For example assume I placed xxx.html into the webapp folder, and then main.css into the webapp/docs/css folder. I would have to change my css reference to:



          By the way, I am assuming that you also uploaded the CSS file.

          • 2. Re: CMS - How to include css file ?
            nidhi_hs

            I have folder structure docs/documentation under the root folder. Html called index.html is placed under documentation folder. CSS called main.css is placed under docs/css folder.

            Yes, I have uploaded the CSS file :)

            • 3. Re: CMS - How to include css file ?
              peterj

              I did a little more research and it appears that when CMS uploads an HTML file, it extracts and stores only the contents between the < body > ...< /body > tags. (Or perhaps it does this when the HTML page is displayed.) This means that the stylesheet link is not in the displayed output, hence your stylesheet will not be referenced.

              • 4. Re: CMS - How to include css file ?
                nidhi_hs

                It looks like only way to apply style to the html content is to embed the styles in the html document itself. Am I right ?

                • 5. Re: CMS - How to include css file ?
                  soshah

                  yes,

                  style tags are filtered out of the content stored by the cms. This is so that the CMS Portlet which displays the content as portlet markup.

                  With a style tag in there the markup would become invalid....Although maybe some browsers could still be forgiving...


                  anyways, the best way is to add the style reference to the JSP page that performs the layout for your portal.

                  In the default portal this is jboss-portal.sar/portal-core.war/layouts/generic/index.jsp and maximized.jsp

                  Thanks

                  • 6. Re: CMS - How to include css file ?
                    nidhi_hs

                    Thanks for all the inputs. I am using header injection using jboss-portlet.xml to include styles.