Join this month's Badge of the Month 💬 discussion about goals and resolutions to earn your exclusive badge! | Earn Badge >
Recently, we updated our Ranks to add Rankings for Qualtrics Partners. If you received a notification between January 23rd and January 24th regarding your XM Community Rank, please ignore it. We apologize for any confusion and inconvenience. Thank you for your patience and understanding.

Reference a CSS file in the File Library

Pete_L
Pete_L NA Level 1 ●
edited April 2021 in Custom Code

Hi everyone - I'm having trouble using a CSS file in the File Library of Qualtrics.

I go to the file -> view file -> copy the link -> past the link in the Look & Feel 'External CSS' box of the Qualtrics survey. But of course the link is a .php jumbled reference, so I'm not sure how to directly reference the css file itself. Referencing it this way is not working.

Any idea how to reference files inside of your File Library for use like this? I do not want to host the CSS file on another server if I don't have to.

Answers

  • mattyb513
    mattyb513 Washington DC Level 4 ●●●●

    This probably isn't helpful, but I can confirm it doesn't work! I've tried it a number of ways. The odd thing is that the browser recognizes it, reads the file, even identifies it as a stylesheet via the mime type, but for some reason doesn't apply the style

  • Armadous
    edited June 2019

    The link itself to File.php with the file unique identifier is actually fine. The problem is that when File.php serves the css file, it doesn't set the response header that allows the file to be interpreted as a style sheet. It should be 'text/css' but it's set to 'text/plain'.

    https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types#textplain

    Unless Qultrics adds CSS support to the files library, the only way I know to make this work is to load the file with javascript and inject the contents into a style block. This is likely more trouble than it's worth.

  • Pete_L
    Pete_L NA Level 1 ●

    Just updating the thread that this is still an issue. All CSS files are being hosted externally, outside of Qualtrics for my projects.

  • fleb
    fleb Czech Republic Level 3 ●●●

    Just for others who'd also try to solve this: I've tried to import the stylesheet using <link rel="stylesheet" href="URL">and it also didn't help. Using the old Look&feel editor also not...
    @Pete_L : Have you tried to contact the Qualtrics support about this issue? I think this should work...

  • Pete_L
    Pete_L NA Level 1 ●

    @fleb - You can go to the Look & Feel > Header > Source View and paste that html code there and it will work correctly :smile: That's how I'm currently handling it for my projects.

    I have not contacted Qualtrics support but will go ahead and put in a feature request for this now that the new "Idea" thread exists!

  • when you say paste that html code...are you pointing to the css file in the File Library? it still doesnt work for me:


  • Pete_L
    Pete_L NA Level 1 ●

    @icegoffy sorry for the slow reply! We are hosting the files externally outside of Qualtrics.

    We have never been able to get it to work using the Qualtrics library.