{"id":111,"date":"2017-09-13T17:42:38","date_gmt":"2017-09-13T17:42:38","guid":{"rendered":"https:\/\/openbook.ums.edu.my\/userguide\/chapter\/apply-custom-styles\/"},"modified":"2024-09-19T04:19:25","modified_gmt":"2024-09-19T04:19:25","slug":"apply-custom-styles","status":"publish","type":"chapter","link":"https:\/\/openbook.ums.edu.my\/userguide\/chapter\/apply-custom-styles\/","title":{"raw":"Apply Custom Styles","rendered":"Apply Custom Styles"},"content":{"raw":"The Custom Styles feature allows you to add CSS to your book\u2019s stylesheet to change the default formatting for any of our themes. If you\u2019re fluent in CSS, this means that you can customize the appearance your web, ebook (EPUB) and PDF (print and digital) files. Please note that Pressbooks does not offer support for comprehensive CSS formatting, and on the pressbooks.pub network, Custom CSS is only available with the Collaboration plan.\n<h1><a id=\"instructions\" href=\"\"><\/a>Add Custom Styles<\/h1>\nOnce you've <a href=\"https:\/\/pressbooks.pub\/guide\/chapter\/appearance\/#howtochangeatheme\">selected a theme<\/a> for your book, you can add custom styles for the webbook, ebook, and PDF exports separately. To do so:\n<ol>\n \t<li>Click '<strong>Appearance \u2192 Custom Styles<\/strong>'.<\/li>\n \t<li><strong>Select the Export Format you would like to customize<\/strong> from the dropdown menu. Options include web, Ebook, or PDF.\n<img class=\"alignnone wp-image-357 size-full\" style=\"orphans: 1; text-align: initial; font-size: 1em;\" src=\"https:\/\/pressbooks.pub\/app\/uploads\/sites\/4748\/2013\/12\/Screen-Shot-2017-09-13-at-13.23.14.png\" alt=\"\" width=\"321\" height=\"97\"><\/li>\n \t<li>Add your desired CSS modifications to the '<strong>Your Styles'<\/strong> input section<img class=\"wp-image-358 size-full alignnone\" style=\"orphans: 1; text-align: initial; font-size: 1em;\" src=\"https:\/\/pressbooks.pub\/app\/uploads\/sites\/4748\/2022\/10\/CSS-6-e1634189118501.jpeg\" alt=\"\" width=\"1106\" height=\"632\"><\/li>\n \t<li>Click the <strong>Save <\/strong>button to save your changes<\/li>\n<\/ol>\n<div class=\"textbox\"><strong>NOTE:<\/strong> If you\u2019ve made changes to the ebook or PDF, you will need to export a new set of files to see them.<\/div>\n<h1><a id=\"whatchangesarepossible\" href=\"\"><\/a>What Changes are Possible<\/h1>\nIn the images above, you can see changes to the color of the chapter-number and the line-spacing in the body text for the PDF format. These were controlled by adding the following to the \u201cYour Styles\u201d section:\n\n<code>.chapter-number {\ncolor: #c8000c; }\nbody {\nline-height: 2em; }<\/code>\n\nHere\u2019s what the PDF looks like before and after:\n\n<a href=\"https:\/\/pressbooks.pub\/guide\/wp-content\/uploads\/sites\/10270\/2017\/09\/CSS-4.jpeg\"><img class=\"size-full wp-image-359 aligncenter\" src=\"https:\/\/pressbooks.pub\/app\/uploads\/sites\/4748\/2022\/10\/CSS-4.jpeg\" alt=\"\" width=\"1776\" height=\"932\"><\/a>\n\nTo see what other kinds of things you can customize, you can look through the theme stylesheet in the \u201cTheme Styles\u201d section. This allows you to find the styles for various elements in your book, then copy the corresponding section into \u201cYour Styles\u201d to edit. Anything you enter will override the original theme styles for that element.\n\nEven if you\u2019re fluent in CSS, remember that each of the formats Pressbooks produces operates slightly differently, so what you may be used to using for a web page won\u2019t necessarily translate to a PDF or ebook. While you\u2019re figuring things out, we recommend using the XHTML export to help you isolate particular classes and elements.\n<h2>Keyboard Commands for CSS<\/h2>\nPressbooks\u2019 custom styles editor uses <a href=\"https:\/\/codemirror.net\/demo\/search.html\">CodeMirror<\/a> keyboard commands. You can use the following keyboard commands on any of the three style sheets for your book.\n<div>\n<table style=\"width: 468px;\">\n<tbody>\n<tr>\n<td style=\"width: 153.140625px;\"><\/td>\n<td style=\"width: 163.59375px;\"><strong>For PC<\/strong><\/td>\n<td style=\"width: 108.46875px;\"><strong>For Mac<\/strong><\/td>\n<\/tr>\n<tr>\n<td style=\"width: 153.140625px;\"><strong>Start searching<\/strong><\/td>\n<td style=\"width: 163.59375px;\">CTRL + F<\/td>\n<td style=\"width: 108.46875px;\">Cmd + F<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 153.140625px;\"><strong>Find next<\/strong><\/td>\n<td style=\"width: 163.59375px;\">CTRL + G<\/td>\n<td style=\"width: 108.46875px;\">CMD + G<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 153.140625px;\"><strong>Find previous<\/strong><\/td>\n<td style=\"width: 163.59375px;\">Shift + CTRL + G<\/td>\n<td style=\"width: 108.46875px;\">Shift + CMD + G<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 153.140625px;\"><strong>Replace<\/strong><\/td>\n<td style=\"width: 163.59375px;\">Shift + CTRL + F<\/td>\n<td style=\"width: 108.46875px;\">CMD + Option + F<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 153.140625px;\"><strong>Replace all<\/strong><\/td>\n<td style=\"width: 163.59375px;\">Shift + CTRL + R<\/td>\n<td style=\"width: 108.46875px;\">Shift + CMD + Option + F<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 153.140625px;\"><strong>Persistent search*<\/strong><\/td>\n<td style=\"width: 163.59375px;\">Alt + F<\/td>\n<td style=\"width: 108.46875px;\">Alt + F<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 153.140625px;\"><strong>Jump to line<\/strong><\/td>\n<td style=\"width: 163.59375px;\">Alt + G<\/td>\n<td style=\"width: 108.46875px;\">Alt + G<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n*<em>In persistent search mode, search dialog does not close automatically. Use \u201cEnter\u201d to find the next term, and Shift + Enter to find the previous term<\/em>\n<h1>View and Restore Previous Revisions<\/h1>\n<img class=\"size-full wp-image-360 alignright\" src=\"https:\/\/pressbooks.pub\/app\/uploads\/sites\/4748\/2022\/10\/Screenshot-from-2021-10-13-22-31-51.png\" alt=\"\" width=\"287\" height=\"407\">Pressbooks saves the last 10 revisions of any changes you've made for each of the three separate stylesheets. You can access these revisions on the Custom Styles page below the save button.\n\nTo view or restore a previous version of one of your stylesheets:\n<ol>\n \t<li>Click the date stamp for the revision you'd like to view to open the Compare Revisions interface for a particular stylesheet<\/li>\n \t<li>Find the revision you'd like to restore from and click the '<strong>Restore This Revision<\/strong>' button\n<img class=\"alignnone size-full wp-image-361\" src=\"https:\/\/pressbooks.pub\/app\/uploads\/sites\/4748\/2022\/10\/Screenshot-from-2021-10-13-22-34-20.png\" alt=\"\" width=\"1280\" height=\"188\"><\/li>\n<\/ol>\n<h1><a id=\"implicationsforpressbookscustomcss\" href=\"\"><\/a>Pressbooks Custom CSS Theme<\/h1>\nThe Pressbooks Custom CSS theme has been retired in favor of the Custom Styles feature detailed above. Legacy users may still have the Custom CSS theme applied, however. If your book has the Custom CSS theme applied, you will need to stay on that theme or risk losing your changes. If you think you might have to change themes at some point, first copy your stylesheets into a text editor. Then, you can change your theme, navigate to the \u201cCustom Styles\u201d section and re-enter the sections of your stylesheet that you have changed, following the steps detailed above.\n\nIn addition, users with the Pressbooks Custom CSS theme activated must save their custom CSS stylesheets before using the cover generator tool. When you switch to a different theme to generate a cover, you will not be able to access the Pressbooks Custom CSS theme again.\n\n<hr>\n\nPrefer to watch and learn? Watch this instructional video, created by our friends at <a href=\"https:\/\/bccampus.ca\">BCcampus<\/a>.\n\n<iframe id=\"kaltura_player\" src=\"https:\/\/api.ca.kaltura.com\/p\/148\/sp\/14800\/embedIframeJs\/uiconf_id\/23449759\/partner_id\/148?iframeembed=true&amp;playerId=kaltura_player&amp;entry_id=0_gs5r8b3x&amp;flashvars[streamerType]=auto&amp;flashvars[localizationCode]=en&amp;flashvars[leadWithHTML5]=true&amp;flashvars[sideBarContainer.plugin]=true&amp;flashvars[sideBarContainer.position]=left&amp;flashvars[sideBarContainer.clickToClose]=true&amp;flashvars[chapters.plugin]=true&amp;flashvars[chapters.layout]=vertical&amp;flashvars[chapters.thumbnailRotator]=false&amp;flashvars[streamSelector.plugin]=true&amp;flashvars[EmbedPlayer.SpinnerTarget]=videoHolder&amp;flashvars[dualScreen.plugin]=true&amp;flashvars[Kaltura.addCrossoriginToIframe]=true&amp;&amp;wid=0_wfuhig94\" width=\"400\" height=\"285\" allowfullscreen webkitallowfullscreen mozallowfullscreen allow=\"autoplay *; fullscreen *; encrypted-media *\" sandbox=\"allow-downloads allow-forms allow-same-origin allow-scripts allow-top-navigation allow-pointer-lock allow-popups allow-modals allow-orientation-lock allow-popups-to-escape-sandbox allow-presentation allow-top-navigation-by-user-activation\" frameborder=\"0\" title=\"Use Custom Styles\"><\/iframe>","rendered":"<p>The Custom Styles feature allows you to add CSS to your book\u2019s stylesheet to change the default formatting for any of our themes. If you\u2019re fluent in CSS, this means that you can customize the appearance your web, ebook (EPUB) and PDF (print and digital) files. Please note that Pressbooks does not offer support for comprehensive CSS formatting, and on the pressbooks.pub network, Custom CSS is only available with the Collaboration plan.<\/p>\n<h1><a id=\"instructions\" href=\"\"><\/a>Add Custom Styles<\/h1>\n<p>Once you&#8217;ve <a href=\"https:\/\/pressbooks.pub\/guide\/chapter\/appearance\/#howtochangeatheme\">selected a theme<\/a> for your book, you can add custom styles for the webbook, ebook, and PDF exports separately. To do so:<\/p>\n<ol>\n<li>Click &#8216;<strong>Appearance \u2192 Custom Styles<\/strong>&#8216;.<\/li>\n<li><strong>Select the Export Format you would like to customize<\/strong> from the dropdown menu. Options include web, Ebook, or PDF.<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-357 size-full\" style=\"orphans: 1; text-align: initial; font-size: 1em;\" src=\"https:\/\/pressbooks.pub\/app\/uploads\/sites\/4748\/2013\/12\/Screen-Shot-2017-09-13-at-13.23.14.png\" alt=\"\" width=\"321\" height=\"97\" \/><\/li>\n<li>Add your desired CSS modifications to the &#8216;<strong>Your Styles&#8217;<\/strong> input section<img loading=\"lazy\" decoding=\"async\" class=\"wp-image-358 size-full alignnone\" style=\"orphans: 1; text-align: initial; font-size: 1em;\" src=\"https:\/\/pressbooks.pub\/app\/uploads\/sites\/4748\/2022\/10\/CSS-6-e1634189118501.jpeg\" alt=\"\" width=\"1106\" height=\"632\" \/><\/li>\n<li>Click the <strong>Save <\/strong>button to save your changes<\/li>\n<\/ol>\n<div class=\"textbox\"><strong>NOTE:<\/strong> If you\u2019ve made changes to the ebook or PDF, you will need to export a new set of files to see them.<\/div>\n<h1><a id=\"whatchangesarepossible\" href=\"\"><\/a>What Changes are Possible<\/h1>\n<p>In the images above, you can see changes to the color of the chapter-number and the line-spacing in the body text for the PDF format. These were controlled by adding the following to the \u201cYour Styles\u201d section:<\/p>\n<p><code>.chapter-number {<br \/>\ncolor: #c8000c; }<br \/>\nbody {<br \/>\nline-height: 2em; }<\/code><\/p>\n<p>Here\u2019s what the PDF looks like before and after:<\/p>\n<p><a href=\"https:\/\/pressbooks.pub\/guide\/wp-content\/uploads\/sites\/10270\/2017\/09\/CSS-4.jpeg\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-359 aligncenter\" src=\"https:\/\/pressbooks.pub\/app\/uploads\/sites\/4748\/2022\/10\/CSS-4.jpeg\" alt=\"\" width=\"1776\" height=\"932\" \/><\/a><\/p>\n<p>To see what other kinds of things you can customize, you can look through the theme stylesheet in the \u201cTheme Styles\u201d section. This allows you to find the styles for various elements in your book, then copy the corresponding section into \u201cYour Styles\u201d to edit. Anything you enter will override the original theme styles for that element.<\/p>\n<p>Even if you\u2019re fluent in CSS, remember that each of the formats Pressbooks produces operates slightly differently, so what you may be used to using for a web page won\u2019t necessarily translate to a PDF or ebook. While you\u2019re figuring things out, we recommend using the XHTML export to help you isolate particular classes and elements.<\/p>\n<h2>Keyboard Commands for CSS<\/h2>\n<p>Pressbooks\u2019 custom styles editor uses <a href=\"https:\/\/codemirror.net\/demo\/search.html\">CodeMirror<\/a> keyboard commands. You can use the following keyboard commands on any of the three style sheets for your book.<\/p>\n<div>\n<table style=\"width: 468px;\">\n<tbody>\n<tr>\n<td style=\"width: 153.140625px;\"><\/td>\n<td style=\"width: 163.59375px;\"><strong>For PC<\/strong><\/td>\n<td style=\"width: 108.46875px;\"><strong>For Mac<\/strong><\/td>\n<\/tr>\n<tr>\n<td style=\"width: 153.140625px;\"><strong>Start searching<\/strong><\/td>\n<td style=\"width: 163.59375px;\">CTRL + F<\/td>\n<td style=\"width: 108.46875px;\">Cmd + F<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 153.140625px;\"><strong>Find next<\/strong><\/td>\n<td style=\"width: 163.59375px;\">CTRL + G<\/td>\n<td style=\"width: 108.46875px;\">CMD + G<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 153.140625px;\"><strong>Find previous<\/strong><\/td>\n<td style=\"width: 163.59375px;\">Shift + CTRL + G<\/td>\n<td style=\"width: 108.46875px;\">Shift + CMD + G<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 153.140625px;\"><strong>Replace<\/strong><\/td>\n<td style=\"width: 163.59375px;\">Shift + CTRL + F<\/td>\n<td style=\"width: 108.46875px;\">CMD + Option + F<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 153.140625px;\"><strong>Replace all<\/strong><\/td>\n<td style=\"width: 163.59375px;\">Shift + CTRL + R<\/td>\n<td style=\"width: 108.46875px;\">Shift + CMD + Option + F<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 153.140625px;\"><strong>Persistent search*<\/strong><\/td>\n<td style=\"width: 163.59375px;\">Alt + F<\/td>\n<td style=\"width: 108.46875px;\">Alt + F<\/td>\n<\/tr>\n<tr>\n<td style=\"width: 153.140625px;\"><strong>Jump to line<\/strong><\/td>\n<td style=\"width: 163.59375px;\">Alt + G<\/td>\n<td style=\"width: 108.46875px;\">Alt + G<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>*<em>In persistent search mode, search dialog does not close automatically. Use \u201cEnter\u201d to find the next term, and Shift + Enter to find the previous term<\/em><\/p>\n<h1>View and Restore Previous Revisions<\/h1>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-360 alignright\" src=\"https:\/\/pressbooks.pub\/app\/uploads\/sites\/4748\/2022\/10\/Screenshot-from-2021-10-13-22-31-51.png\" alt=\"\" width=\"287\" height=\"407\" \/>Pressbooks saves the last 10 revisions of any changes you&#8217;ve made for each of the three separate stylesheets. You can access these revisions on the Custom Styles page below the save button.<\/p>\n<p>To view or restore a previous version of one of your stylesheets:<\/p>\n<ol>\n<li>Click the date stamp for the revision you&#8217;d like to view to open the Compare Revisions interface for a particular stylesheet<\/li>\n<li>Find the revision you&#8217;d like to restore from and click the &#8216;<strong>Restore This Revision<\/strong>&#8216; button<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-361\" src=\"https:\/\/pressbooks.pub\/app\/uploads\/sites\/4748\/2022\/10\/Screenshot-from-2021-10-13-22-34-20.png\" alt=\"\" width=\"1280\" height=\"188\" \/><\/li>\n<\/ol>\n<h1><a id=\"implicationsforpressbookscustomcss\" href=\"\"><\/a>Pressbooks Custom CSS Theme<\/h1>\n<p>The Pressbooks Custom CSS theme has been retired in favor of the Custom Styles feature detailed above. Legacy users may still have the Custom CSS theme applied, however. If your book has the Custom CSS theme applied, you will need to stay on that theme or risk losing your changes. If you think you might have to change themes at some point, first copy your stylesheets into a text editor. Then, you can change your theme, navigate to the \u201cCustom Styles\u201d section and re-enter the sections of your stylesheet that you have changed, following the steps detailed above.<\/p>\n<p>In addition, users with the Pressbooks Custom CSS theme activated must save their custom CSS stylesheets before using the cover generator tool. When you switch to a different theme to generate a cover, you will not be able to access the Pressbooks Custom CSS theme again.<\/p>\n<hr \/>\n<p>Prefer to watch and learn? Watch this instructional video, created by our friends at <a href=\"https:\/\/bccampus.ca\">BCcampus<\/a>.<\/p>\n<p><iframe loading=\"lazy\" id=\"kaltura_player\" src=\"https:\/\/api.ca.kaltura.com\/p\/148\/sp\/14800\/embedIframeJs\/uiconf_id\/23449759\/partner_id\/148?iframeembed=true&amp;playerId=kaltura_player&amp;entry_id=0_gs5r8b3x&amp;flashvars[streamerType]=auto&amp;flashvars[localizationCode]=en&amp;flashvars[leadWithHTML5]=true&amp;flashvars[sideBarContainer.plugin]=true&amp;flashvars[sideBarContainer.position]=left&amp;flashvars[sideBarContainer.clickToClose]=true&amp;flashvars[chapters.plugin]=true&amp;flashvars[chapters.layout]=vertical&amp;flashvars[chapters.thumbnailRotator]=false&amp;flashvars[streamSelector.plugin]=true&amp;flashvars[EmbedPlayer.SpinnerTarget]=videoHolder&amp;flashvars[dualScreen.plugin]=true&amp;flashvars[Kaltura.addCrossoriginToIframe]=true&amp;&amp;wid=0_wfuhig94\" width=\"400\" height=\"285\" allowfullscreen=\"allowfullscreen\" sandbox=\"allow-downloads allow-forms allow-same-origin allow-scripts allow-top-navigation allow-pointer-lock allow-popups allow-modals allow-orientation-lock allow-popups-to-escape-sandbox allow-presentation allow-top-navigation-by-user-activation\" frameborder=\"0\" title=\"Use Custom Styles\"><\/iframe><\/p>\n","protected":false},"author":1,"menu_order":2,"template":"","meta":{"pb_show_title":"","pb_short_title":"","pb_subtitle":"","pb_authors":[],"pb_section_license":""},"chapter-type":[],"contributor":[],"license":[],"class_list":["post-111","chapter","type-chapter","status-publish","hentry"],"part":108,"_links":{"self":[{"href":"https:\/\/openbook.ums.edu.my\/userguide\/wp-json\/pressbooks\/v2\/chapters\/111","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/openbook.ums.edu.my\/userguide\/wp-json\/pressbooks\/v2\/chapters"}],"about":[{"href":"https:\/\/openbook.ums.edu.my\/userguide\/wp-json\/wp\/v2\/types\/chapter"}],"author":[{"embeddable":true,"href":"https:\/\/openbook.ums.edu.my\/userguide\/wp-json\/wp\/v2\/users\/1"}],"version-history":[{"count":1,"href":"https:\/\/openbook.ums.edu.my\/userguide\/wp-json\/pressbooks\/v2\/chapters\/111\/revisions"}],"predecessor-version":[{"id":112,"href":"https:\/\/openbook.ums.edu.my\/userguide\/wp-json\/pressbooks\/v2\/chapters\/111\/revisions\/112"}],"part":[{"href":"https:\/\/openbook.ums.edu.my\/userguide\/wp-json\/pressbooks\/v2\/parts\/108"}],"metadata":[{"href":"https:\/\/openbook.ums.edu.my\/userguide\/wp-json\/pressbooks\/v2\/chapters\/111\/metadata\/"}],"wp:attachment":[{"href":"https:\/\/openbook.ums.edu.my\/userguide\/wp-json\/wp\/v2\/media?parent=111"}],"wp:term":[{"taxonomy":"chapter-type","embeddable":true,"href":"https:\/\/openbook.ums.edu.my\/userguide\/wp-json\/pressbooks\/v2\/chapter-type?post=111"},{"taxonomy":"contributor","embeddable":true,"href":"https:\/\/openbook.ums.edu.my\/userguide\/wp-json\/wp\/v2\/contributor?post=111"},{"taxonomy":"license","embeddable":true,"href":"https:\/\/openbook.ums.edu.my\/userguide\/wp-json\/wp\/v2\/license?post=111"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}