Reference a CSS file in the File Library | XM Community
Question

Reference a CSS file in the File Library

  • 19 March 2019
  • 8 replies
  • 155 views

Userlevel 3
Badge +9
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.

8 replies

Userlevel 6
Badge +6
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
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.
Userlevel 3
Badge +9
Just updating the thread that this is still an issue. All CSS files are being hosted externally, outside of Qualtrics for my projects.
Userlevel 5
Badge +6
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...
Userlevel 3
Badge +9
@fleb - You can go to the Look & Feel > Header > Source View and paste that html code there and it will work correctly 😀 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!
Userlevel 1

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

Userlevel 3
Badge +9

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.

Userlevel 2
Badge +3

My workaround was to set the type in that head to text/plain. However, I’m not sure if that’s really secure or not. If something changes or there’s a better way to set the mime type to text/css when I initially save the file before uploading to Qualtrics, I’d be open to that.

Leave a Reply