View Single Post
Old 02-09-2017, 10:42 PM   #16
nabsltd
Fanatic
nabsltd ought to be getting tired of karma fortunes by now.nabsltd ought to be getting tired of karma fortunes by now.nabsltd ought to be getting tired of karma fortunes by now.nabsltd ought to be getting tired of karma fortunes by now.nabsltd ought to be getting tired of karma fortunes by now.nabsltd ought to be getting tired of karma fortunes by now.nabsltd ought to be getting tired of karma fortunes by now.nabsltd ought to be getting tired of karma fortunes by now.nabsltd ought to be getting tired of karma fortunes by now.nabsltd ought to be getting tired of karma fortunes by now.nabsltd ought to be getting tired of karma fortunes by now.
 
Posts: 528
Karma: 9529956
Join Date: Aug 2013
Location: Hamden, CT
Device: Kindle Paperwhite (11th gen), Scribe, Kindle 4 Touch
pre isn't required to do fixed formatting

I just re-formatted a book I bought, and hit this same issue. Here's what I used for some source code:

Code:
.div-indent {
	margin-left: 2em;
}
.div-computer {
	margin-top: 4%;
	margin-bottom: 4%;
	margin-left: 2em;
	margin-right: 2em;
	font-size: 90%;
	font-family: "Consolas", "Courier New", "Courier Std", "Courier", "DejaVu Sans Mono", monospace;
}
.para-left {
	text-align: left;
}
Code:
<div class="div-computer">
  <p class="para-left">void main (void)</p>
  <div class="div-indent">
    <p class="para-left">{</p>
    <p class="para-left">char keyfile = fopen("108952.jpg");</p>
    <p class="para-left">char extract;</p>
    <p class="para-left">while (infile)</p>
    <div class="div-indent">
      <p class="para-left">{</p>
      <p class="para-left">extract = asc(least_sig_bit(keyfile) / 2)^6;</p>
      <p class="para-left">stdoutput(extract);</p>
      <p class="para-left">}</p>
    </div>
    <p class="para-left">}</p>
  </div>
</div>
No complaints about the code...I know it's not valid, but that's what was in the book. The attachment shows how it renders.
Attached Thumbnails
Click image for larger version

Name:	SourceCode.jpg
Views:	222
Size:	20.0 KB
ID:	154888  
nabsltd is offline   Reply With Quote