Help with book/styles.css

Help with book/styles.css

by Matthew Utterback -
Number of replies: 4

Greetings,

I am copying existing html into a Moodle book chapter. This doc has some complex tables, and I'd like to grab the .css from my original html (from an EPUB.)  I've updated mod/books/styles.css but my new styles aren't displaying.

All of the styles from the original moodle mod/books/styles.css seem to have 

.path-mod-book .navbottom
I've added to the styles.css with styles like this one, below. Do I need some kind of ".path-mod-book" prefix?
Many thanks!

  table.border-k td{
    margin-top:1em;
    margin-bottom:1em;
    margin-left:em;
    margin-right:0em;
    padding: 0.5em;
    padding-right: 1.5em;
    border:2px solid #000000;
    border-collapse:collapse;
    font-size:250%;
    vertical-align:top;
    }




Average of ratings: -
In reply to Matthew Utterback

Re: Help with book/styles.css

by Eoin Campbell -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers

You probably need to add an asterisk between the page-type class and the element, such as in the lines below. .path-mod-book covers the entire book page, but .book_content limits the scope to just the content of the book, and not the surrounding navigation. 

.path-mod-book * table.border-k td{ ... }
.book_content * table.border-k td{ ... }

If you use a theme such as Adaptable, you can place the CSS in the Site administration > Appearance > Themes > Adaptable > Custom CSS & JS page instead of mod/book/styles.css

In reply to Eoin Campbell

Re: Help with book/styles.css

by Matthew Utterback -
Many thanks - unfortunately we can't change the theme on this site.

This may be a basic question, but do you need to restart the server for the new .css to kick in as well?
In reply to Matthew Utterback

Re: Help with book/styles.css

by Eoin Campbell -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers
No. but you probably need to purge the Themes cache on the Site administration > Development > Purge caches page.
In reply to Eoin Campbell

Re: Help with book/styles.css

by Matthew Utterback -
Thank you - got this working with the overall SCSS in the theme, applied to the course ID.

It was working all week. Now, we paste in the HTML (using the html "<>" in the editor. Unclick the tag and the preview looks perfect, with the css applied. Then click Save and the resulting page has the html tags displayed. Very odd. We did flush the cache, but I don't see how that would have caused this to change.

Any ideas?