Select to view content in your preferred language

Can I use inline styles since external style sheets aren't supported?

256
5
Jump to solution
08-21-2024 09:50 AM
GEO_SARGE
Occasional Contributor

I am working on building out a hub site and I'm wondering if inline styles will work since external style sheets aren't supported.  

0 Kudos
1 Solution

Accepted Solutions
KlaraSchmitt
Esri Regular Contributor

Ah. Okay, so the <form></form> elements will not work. I thought you were asking specifically about CSS, which is supported, but has some limitations when Shadow DOM is involved. With regards to HTML, we do not support form elements and/or Javascript code as it poses a security risk to our platform. 

For a list of supported HTML, please refer to this documentation: https://doc.arcgis.com/en/hub/sites/add-text-and-images.htm#ESRI_SECTION1_15E3903373B04DF391D6DF5D15... 

Additionally, we try to support most Calcite web component's from Esri's design system: https://developers.arcgis.com/calcite-design-system/components/ 

View solution in original post

0 Kudos
5 Replies
KlaraSchmitt
Esri Regular Contributor

Yes, you can use inline styles directly on some elements and also styles you embed via <style></style> tags into a Text Card somewhere on your page. You may find that not all your styles will stick if you are using Calcite web components. This is because of something called the Shadow DOM, which is kind of hard to explain, so the short answer is that some styles are buried in a way that's difficult to overwrite.

GEO_SARGE
Occasional Contributor

Thank you for the quick answer. I understand the logistics of the Shadow DOM - just wasn't sure how creative I can be in the hub.  I'm sure I'm going to find the limit but in the short term I've built a form using some of the <form></form> tags  but the (I'm guessing default CMS) defaults are overriding some of the context so it's a learning curve.

0 Kudos
KlaraSchmitt
Esri Regular Contributor

Ah. Okay, so the <form></form> elements will not work. I thought you were asking specifically about CSS, which is supported, but has some limitations when Shadow DOM is involved. With regards to HTML, we do not support form elements and/or Javascript code as it poses a security risk to our platform. 

For a list of supported HTML, please refer to this documentation: https://doc.arcgis.com/en/hub/sites/add-text-and-images.htm#ESRI_SECTION1_15E3903373B04DF391D6DF5D15... 

Additionally, we try to support most Calcite web component's from Esri's design system: https://developers.arcgis.com/calcite-design-system/components/ 

0 Kudos
GEO_SARGE
Occasional Contributor

I was initially asking about the CSS in the realm of styling but you answered a lot of the follow on questions I hadn't asked yet. Thank you for saving me some time, I'll read up some more. 

0 Kudos
KlaraSchmitt
Esri Regular Contributor

Excellent. Glad I could help. 🙂

0 Kudos