Reference a CSS file in the File Library

Pete_L
Pete_L Community Member, Qualtrics Brand Admin Qubie ✭
edited April 22 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 DCCommunity Member Superuser ✭✭✭✭

    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
    Armadous Community Member Qubie ✭
    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 Community Member, Qualtrics Brand Admin Qubie ✭

    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 RepublicCommunity Member Sage ✭✭✭

    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 Community Member, Qualtrics Brand Admin Qubie ✭

    @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!

  • icegoffy
    icegoffy VICCommunity Member, Qualtrics Brand Admin Qubie ✭

    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 Community Member, Qualtrics Brand Admin Qubie ✭

    @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.