I am currently using Jekyll, and I am attempting to create something that looks like this, where the code is on the right and the explanations are on the left.
The output from Jekyll's markdown processor will look something like this:
<p>Some explanation goes here</p>
<pre> // some code goes here </pre>
<p>Another example...</p>
<pre> // more example code goes here </pre>
So far, I have been able to achieve the two-column look by using float
in CSS and making width: 50%;
.
pre {
float: right;
width: 50%;
}
h1, h2, h3, h4, h5, h6, p, a {
float: left;
width: 50%;
margin-right: 50%;
}
However, this results in the <pre>
tags being below the text I want, whereas I want the code to the right of the text.
What would be the best way to solve this problem using pure CSS?
Thanks!