4

I want to show border 1.5px, I can't able to see. It's showing same as 1px. I don't want 2 px, bcz it's much broad for me

.newTitle {
  border-bottom: 1.5px solid orange;
}
<p class="newTitle">stack Overflow</p>
  • 8
    Well, as long as your monitor can't illuminate *half* a pixel, I think you might be out of luck there... – domsson Apr 05 '17 at 12:36
  • Try a double border instead of a solid one? It really depends on the color. 2px light grey won't look as weird as 2px red for example. – Ravenous Apr 05 '17 at 12:41
  • (To be fair, 1px in CSS doesn't necessarily equal 1 physical pixel, but often enough, this is actually the case) – domsson Apr 05 '17 at 12:45
  • [This](http://atirip.com/2013/09/22/yes-we-can-do-fraction-of-a-pixel/) article shows a neat trick to fake the half pixel, which browsers mostly just ignore. – Douwe de Haan Apr 05 '17 at 12:47
  • you'll have to find a compromise since pixels cannot be broken in pieces , a shadow might give the illusion to thicken it a bit : box-shadow: 0 1px 1px -1px orange demo : https://jsfiddle.net/phugj8d2/ – G-Cyrillus Apr 05 '17 at 12:47

3 Answers3

6

comment turned into answer:

you'll have to find a compromise since pixels cannot be broken in pieces , a shadow might give the illusion to thicken it a bit :

box-shadow: 0 1px 1px -1px orange

demo

.newTitle {
  border-bottom: 1.5px solid orange;
}

.bis {
  box-shadow: 0 1px 1px -1px orange
}

.ter {
  border-bottom: 2px solid orange;
}
<p class="newTitle">stack Overflow  (1px)</p>
<p class="newTitle bis">stack Overflow (1px + shadow)</p>
<p class="newTitle ter">stack Overflow (2px)</p>
G-Cyrillus
  • 101,410
  • 14
  • 105
  • 129
0

Considering the definition of a pixel this doesnt surprise me. Maybe an added shadow feels better than the 2 px border to you.

Peter-Paul
  • 118
  • 5
-2

You can try it in EM. Assuming that EM is 16px, 1.5px = 0.09375em Good luck!

Pablo Mariante
  • 350
  • 3
  • 11