Quote:
Originally Posted by tiandijie
Hi sigil fans, I'm having a little dumb question here and looking for some slutions. I'm creating a book about html, and I need to show some code examples in my book, like <p style="background-color:yellow;">XXXX</p>. the problem is sigil will just treat them as general code and execute them, so I can only see “XXXX” in book view with yellow background. I tried to wrap them with code tag, like:
<code>
<p style="background-color:yellow;">XXXX</p>
</code>
but this does not work. For now I should add some random notations between tags so Sigil won't execute them. Does anyone have some better ideas? 
|
Do the following:
1. In your .xhtml file write:
Code:
<div class="code">
<pre>
<p class="background">XXX</p>
</pre>
</div>
2. In your .css file write:
Code:
.code {
font-family: "monospace"; /* This wouldn't be necessary if you use the <pre> tag but... */
background: #eee;
font-size: 1.2em; /* change the font size if you wish */
font-weight: bold; /* change this to normal if you wish */
padding: 0 1em;
border: 1px dotted;
}
This is how it looks in Sigil:
Below I attach the respective epub so you can understand better all the things.
Regards
Rubén