The place for more technical questions for those who want to create new pagetypes or bespoke functionality.

Styles optional property

Plus d'informations
il y a 9 ans 5 mois #4240 par takeshi
Styles optional property a été créé par takeshi
Hi, first time posting here - looking to customise my XOT installation.

What is the "Styles" optional property is for (as opposed to Stylesheet)? I see it exists on the main LO as well as each of the pages, and appears to expect some code. What type/structure of code is expected? Can anyone give some example code?

Many thanks for any enlightenment!

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 9 ans 5 mois #4241 par ronm
Réponse de ronm sur le sujet Styles optional property
The stylesheet option is for attaching a stylesheet that applies across the whole LO.
The styles option attached to the first icon in the tree allows adding css directly that will apply across the whole LO.
The styles option attached to each page type added to your project allows css to be added that only applies to that specific page.
There are similar script options too.
e.g. in the styles option attached to the parent icon you could add:
Code:
#x_pageHolder{background:yellow;}
To change the background colour throughout the LO to yellow.
HTH
Ron

Xerte developer & trainer
e-learning & m-learning consultant
mitchellmedia.co.uk | xerteacademy.com | learningapps.co.uk
Note: Support here is voluntary and meant for users to support each other.
Need direct commercial support with Xerte? mitchellmedia.co.uk/contact/
Les utilisateur(s) suivant ont remercié: takeshi

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 9 ans 5 mois #4245 par takeshi
Réponse de takeshi sur le sujet Styles optional property
Thanks Ron for the informative reply. I had wondered if Styles was related to creating custom text styles (like the Block Styles or Inline Styles) that can be chosen from the text field dropdown menu, but it appears it was not the case. Or is this still something I can do with Styles/Stylesheet?

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 9 ans 5 mois #4246 par ronm
Réponse de ronm sur le sujet Styles optional property
No you can't add css/styles to the optional styles property and have those appear in the drop down menu of the editor. You would have to customise the editor code for that. The styles and stylesheet options that you can add to a project control the playback of the project not how the editor works.
HTH
Ron

Xerte developer & trainer
e-learning & m-learning consultant
mitchellmedia.co.uk | xerteacademy.com | learningapps.co.uk
Note: Support here is voluntary and meant for users to support each other.
Need direct commercial support with Xerte? mitchellmedia.co.uk/contact/

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 9 ans 5 mois #4247 par takeshi
Réponse de takeshi sur le sujet Styles optional property
Ok, thanks, I understand. I'm more dabbler than developer - would customising the editor code for that purpose be a simple task, or best to shelve that idea?

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 9 ans 5 mois #4249 par Fay
Réponse de Fay sur le sujet Styles optional property
Hi, the file you'd need to edit to add new options to the styles drop down is editor/js/vendor/ckeditor/styles.js

It would be pretty straight forward to do i think - just duplicate one of the existing styles, change its name and edit its styles properties.
Les utilisateur(s) suivant ont remercié: takeshi

Connexion ou Créer un compte pour participer à la conversation.

Modérateurs: JohnSmith
Temps de génération de la page : 0.143 secondes
Copyright © 2026 The Xerte Project.
Xerte logo Apereo logo OSI Logo