Skip to content

Instantly share code, notes, and snippets.

@kizu
Created November 28, 2012 13:04
Show Gist options
  • Save kizu/4161142 to your computer and use it in GitHub Desktop.
Save kizu/4161142 to your computer and use it in GitHub Desktop.
CSS Dot Leaders With Textured Background
/**
* CSS Dot Leaders With Textured Background
*/
html {
background: #f06;
background: linear-gradient(45deg, #f06, yellow);
min-height: 100%;
font: 20px/1.4 Helvetica, Arial sans-serif
}
dl {
overflow: hidden;
}
dt {
float: left;
padding: 0 .4em 0 0;
margin: 0;
}
dd {
float: right;
padding: 0 0 0 .4em;
margin: 0;
}
/* That's the leader! */
dl:after {
content: "";
display: block;
overflow: hidden;
height: 1em;
border-bottom: 1px dotted;
}
<dl>
<dt>Salmon Ravioli</dt>
<dd>7.95</dd>
</dl>
<dl>
<dt>Fried Calamari</dt>
<dd>8.95</dd>
</dl>
<dl>
<dt>Almond Prawn Cocktail</dt>
<dd>712.95</dd>
</dl>
<dl>
<dt>Bruschetta</dt>
<dd>5.25</dd>
</dl>
<dl>
<dt>Margherita Pizza </dt>
<dd>0.95</dd>
</dl>
// alert('Hello world!');
{"view":"split-vertical","fontsize":"100","seethrough":"","prefixfree":"1","page":"css"}
@Bazikg
Copy link

Bazikg commented Feb 9, 2014

I created an account here just so that I could say thank you for this - you have without knowing saved my ass from 10,000 hours worth of "how do I do that" head banging...

Thank you very much!!

@jesuscript
Copy link

+1. Looked at another 3 different solutions before finding this and it's by far the best one!

@alexvkcr
Copy link

alexvkcr commented Oct 8, 2019

Great job, althought it won-t work on a line that needs wrapping

@kizu
Copy link
Author

kizu commented Oct 8, 2019

@alexvkcr here is a bit more modern version that works with multiline items :) https://codepen.io/kizu/pen/xxxbyBm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment