After an outage on September 1, the Instructure Community is now fully available, including guides, release notes, forums, and groups. If some styling still looks unusual, clear your cache and cookies.
Found this content helpful? Log in or sign up to leave a like!
I am looking to utilize CSS and JavaScript to create some custom styling for a new Course Template, but I cannot seem to find any documentation on the use of custom scripts within Canvas. The only thing I can find on the guides is how to upload the files.
Does anyone know of any good documentation or at least a starting point for the actual files themselves? I am looking for information such as:
I would love to see some example code so I can at least get an idea of what to do. I already know how to write basic full-stack web apps, but it is frustrating that Canvas offers the use of custom code but doesn't provide any docs (at least that I can find...). I am yet to check github.
Right now I am creating Pages with the built-in html editor, but it is quite slow-going as I can't use any custom classes and certain tags get automatically removed, not to mention inline css styling per html element...
Hi @jpastorek,
I am not a developer and only an admin/main technical support person for Canvas at my institution.
What I can say in general is that it can be challenging to find locations of custom CSS and JS with Canvas because: (1) even if they work, they are not officially supported and (2) if someone posted a series of examples, they (even with a disclaimer) could be expected to support (fix) it.
With that said:
I hope this information helps you out, even if only a little bit.
-Doug
In your research you might find these resources handy:
Digging through the elements to the specific one you want to attempt to style requires a bit of knowledge about CSS specificity and perhaps even ReactJS.
You may consider adding classes to items that would be on wrappers to style certain elements containing them using preexisting classes that come with Canvas default theme. I don't know all the ones in the default them accomplish certain styling so I end up poking around on UI elements within Canvas using browser developer tools to see which classes achieve certain effects. I borrowed some code from another institution that had figured out some things on their own. Also I support an instructor who is one of the only qualified Navajo language instructors in Arizona who is asked to teach online. Since Navajo is a dying language I often relent with her that the written language doesn't have a lot of web front-end technology love. I've had to resort to taking screenshots of documents to embed in Canvas RCE that can use the Navajo glyph fonts when it would be much more conducive to be able to type them into the RCE and render the characters there.
Here is an example of a test override CSS file contents:
@font-face {
font-family: 'Verdana Navajo';
src: url('https://edutechie.ws/webfonts_experiment/fonts/VERDN.eot');
src: url('https://edutechie.ws/webfonts_experiment/fonts/VERDN.eot?#iefix') format('embedded-opentype'),
url('https://edutechie.ws/webfonts_experiment/fonts/VERDN.woff2') format('woff2'),
url('https://edutechie.ws/webfonts_experiment/fonts/VERDN.woff') format('woff'),
url('https://edutechie.ws/webfonts_experiment/fonts/VERDN.ttf') format('truetype'),
url('https://edutechie.ws/webfonts_experiment/fonts/VERDN.svg#Verdana Navajo') format('svg');
}
.navajo {
font-family: 'Verdana Navajo';
font-weight: bold;
font-size:2em;
}
Here's the HTML code I used in a page for the RCE:
<a id="start" class="Button Button--primary" href="#">Start Here</a>
<a id="instructor" class="Button Button--primary" href="#">Your Instructor</a>
<a id="tutorial" class="Button Button--primary" href="#">Canvas Tutorial</a>
<a id="resources" class="Button Button--primary" href="#">Additional Resources</a>
<div class="navajo">1234567890[]!@#$%&*()</div>
The Navajo font uses the number keys and other characters for certain glyphs which is why you see those in the HTML code.
The rendered page looks like this:
Good luck on your research!
I did a lot of manual editing of our instance without reading any documentation. I've gotten used to the Canvas architecture over the years, but I remember it was quite daunting when I just got started, but really, CSS and JS works the exact same way it would on any regular website. So you could read whatever guide/basic CSS and JS documentation you can find and it will apply to Canvas.
To answer your questions:
Also, I highly recommend you take the basic courses in CSS and JavaScript on Codecademy before you begin. It doesn't take that long and it will actually save you a lot of time - it is faster to learn and then do than the other way around. 😉
I work on the DesignPLUS product at Cidi Labs and we use the custom CSS/JS feature in Canvas extensively.
To answer your questions directly,
If it would be helpful to see some of the styles you can achieve via custom CSS/JS, check out the public DesignPLUS Library course to see samples of what's been built with our tools that rely solely on custom CSS/JS files.
And have fun with it!
@EthanDeceuster, do you find that using custom CSS within DesignPlus "flickers" the page? I have a template that was created by the admin, but in my course, I am using custom CSS to make some adjustments. When doing so, the template loads first, and then less than a half second (but noticeable), the custom CSS loads, so you see a noticeable flicker.
I attached an example video of this. I have yet to find a workaround or a fix to address this.
Since the CSS in your course files is dynamically appended to the page after the content has loaded, the flicker effect is expected behavior and a known downside of using the Custom CSS tool at a course level. See the user guide for other details about this specific tool.
The only workaround to end the flicker effect is to add your custom CSS code to the CSS file in the root or sub-account Theme in Canvas. If your CSS lives there, then it will load simultaneously with the rest of the content.
In the future, feel free to submit questions directly to support@cidilabs.com or join our community Slack group. Thank you!
Excellent, thanks! And thanks for the resources.
To interact with Panda Bot, our automated chatbot, you need to sign up or log in:
Sign inTo interact with Panda Bot, our automated chatbot, you need to sign up or log in:
Sign in