A pixel is the smallest unit value to render. But you can fool the thickness with optical illusions by changing colors. (The eye can see only a specific resolution .)
Here is a test to prove it:
div { border-color: blue; border-style: solid; margin: 2px; } div.b1 { border-width: 1px; } div.b2 { border-width: 0.1em; } div.b3 { border-width: 0.01em; } div.b4 { border-width: 1px; border-color: rgb(160,160,255); }
<div class="b1">Some text</div> <div class="b2">Some text</div> <div class="b3">Some text</div> <div class="b4">Some text</div>
Exit

This gives the illusion that the last DIV has a smaller border width because the blue border shifts more with the white background.
Edit: alternative solution
Alpha values ββcan also be used to simulate the same effect without the need to calculate and manipulate RGB values.
.container { border-style: solid; border-width: 1px; margin-bottom: 10px; } .border-100 { border-color: rgba(0,0,255,1); } .border-75 { border-color: rgba(0,0,255,0.75); } .border-50 { border-color: rgba(0,0,255,0.5); } .border-25 { border-color: rgba(0,0,255,0.25); }
<div class="container border-100">Container 1 (alpha = 1)</div> <div class="container border-75">Container 2 (alpha = 0.75)</div> <div class="container border-50">Container 3 (alpha = 0.5)</div> <div class="container border-25">Container 4 (alpha = 0.25)</div>
Yanick Rochon Dec 15 '12 at 10:11 2012-12-15 10:11
source share