I’m trying to style an image with a white border around it like in the following:

If I did:
<ul class="learn">
<li class="thumbnaile" > <img id="portrait" src="/assets/allyson.jpg" class="stretch" />
</li>
</ul>
…then add padding to .thumbnaile…
Is there a better/ more efficient way of doing it than this?
You could either use
border(which is certainly the obvious choice), but there’s alsopaddingandbox-shadow:JS Fiddle demo.
In this example the
imgelement is padded by4px, which allows thebackground-colorto extend out from ‘behind’ the image.JS Fiddle demo.
Because
box-shadowdoesn’t displace the element themarginis required to allow for thebox-shadowto show on all sides.