Skip to content

Instantly share code, notes, and snippets.

@dennisfrank
Created February 6, 2012 17:34
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dennisfrank/1753540 to your computer and use it in GitHub Desktop.
Save dennisfrank/1753540 to your computer and use it in GitHub Desktop.
Flexible inline text with background color and large right padding
/**
* Flexible inline text with background color and large right padding
*/
body {
width: 50%;
background: #363532;
}
p {
display: inline;
}
p, p>span {
position: relative;
right: 4em; /* 4em right margin */
line-height: 2em;
padding: .3em 0; /* line padding */
background: #fff;
}
span>span {
position: relative;
left: .5em; /* left margin */
}
p {
left: 4em;
}
<p>
<span><span>Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis
vestibulum. Morbi leo risus, porta ac consectetur ac, vestibulum
at eros. Donec id elit non mi porta gravida at eget metus.</span></span>
</p>
{"view":"split","prefixfree":"1","page":"css"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment