How to link style.css

Hi there!

Dear community,

I have a question. Is it possible to link style.css file to custom dataset design?
How can I do that?

Could you help me, please.

Thank you in advance.

1 Like

Hi @Kuba,

For custom forms, it is possible to use a custom style for each data set, using style.css will make a global affect but instead you can use ‘source’ in the HTML editor of your data set and add <style></style>. See screenshot: Maintainence app → Data set, select data set options [three vertical dots] → Design data entry form → Source


If you already know this and you don’t want to use a style using this method, it might be possible to affect elements in your data set through the style.css by adding tags [class & id] to the elements in your custom form but from what I understand is that the effect will be on all similar elements in all of the dhis2 UI.

I hope this helps. (: :+1:

1 Like

Thanks, Gassim.
I am doing like you say right now. But I want to link style.css file to html separatly. is it possible?

1 Like

You’re welcome! I expected so but was being sure. Did you add the styles to the style.css file?

(and actually, sorry @Kuba, do you mean the /api/33/files/style style.css file or do you mean that you upload your own style.css file in the instance and then link it to the form?)

I tried before to use style.css but it wasn’t working I don’t know why: UI Customization (style.css) not taking effect?

Yes, I upload my own style.css file in the instance and then link it to the form, but it doesn’t affect.

1 Like