CSS content attribute: loading text from a TXT file

949 Views Asked by At

I need to know if it's possible to load text from a TXT file with the CSS "content" attribute? I searched around and didn't find anything.

I have the following CSS:

.custom div.ot-loginPageCopyright::after {
    content: url('copyright.txt');
    text-indent: 0;
    display: block;
    line-height: initial;
}

The browser does request and download the .txt file, but nothing is displayed. It will display the text when it is a string literal in the CSS, but I was hoping to have some copyright information stored separately from the CSS in a text file, in case it needs to be updated, you could just update the text file without touching the CSS.

Note: I know how to do this via JS, but this has to be done via CSS, as no changes can be made to the HTML or JS. So please: no comments suggesting that this should be done in some other way except CSS (if it's possible).

Thanks!

1

There are 1 best solutions below

0
Brien Halstead On

Thanks for the comment @rawnewdlz! I saw the hack for using a SVG, but I was wondering if it was at all possible feeding in a text file into the content, which is not possible.