Totally same linear-gradient lines looks different









up vote
0
down vote

favorite












Why is it like this?
enter image description here



Codepen example:
https://codepen.io/bofemptiness/pen/PxGePa?page=1&



The problem is more about why same lines are different, not a scale.



css:



.hr
width: 100%;
margin:10px;
background: linear-gradient(to right, rgba(0, 0, 0, 0), rgba(0, 0, 0, 65%), rgba(0, 0, 0, 0));
border: 0;
height: 1px;
padding: 0;
font-size: 16px;
display: inline-block;



If I make height: 0.8px; with normal PC scale 100% some lines will just disappear..



P.S. Laptops is scaled 125% by default:
enter image description here










share|improve this question



















  • 1




    Worked for me (Chrome/OSX). In which browser and OS are you testing ?
    – Niloct
    Nov 11 at 17:38










  • chrome. notebok. windows 10 scale 125% (standart notebok scale)
    – RTW TMI
    Nov 11 at 17:51











  • just scale and you will see the problem
    – RTW TMI
    Nov 11 at 17:53










  • Dont scale then lol
    – Lawrence Cherone
    Nov 11 at 17:58






  • 1




    you can set initial scale via meta tags to prevent it.
    – Lawrence Cherone
    Nov 11 at 18:03














up vote
0
down vote

favorite












Why is it like this?
enter image description here



Codepen example:
https://codepen.io/bofemptiness/pen/PxGePa?page=1&



The problem is more about why same lines are different, not a scale.



css:



.hr
width: 100%;
margin:10px;
background: linear-gradient(to right, rgba(0, 0, 0, 0), rgba(0, 0, 0, 65%), rgba(0, 0, 0, 0));
border: 0;
height: 1px;
padding: 0;
font-size: 16px;
display: inline-block;



If I make height: 0.8px; with normal PC scale 100% some lines will just disappear..



P.S. Laptops is scaled 125% by default:
enter image description here










share|improve this question



















  • 1




    Worked for me (Chrome/OSX). In which browser and OS are you testing ?
    – Niloct
    Nov 11 at 17:38










  • chrome. notebok. windows 10 scale 125% (standart notebok scale)
    – RTW TMI
    Nov 11 at 17:51











  • just scale and you will see the problem
    – RTW TMI
    Nov 11 at 17:53










  • Dont scale then lol
    – Lawrence Cherone
    Nov 11 at 17:58






  • 1




    you can set initial scale via meta tags to prevent it.
    – Lawrence Cherone
    Nov 11 at 18:03












up vote
0
down vote

favorite









up vote
0
down vote

favorite











Why is it like this?
enter image description here



Codepen example:
https://codepen.io/bofemptiness/pen/PxGePa?page=1&



The problem is more about why same lines are different, not a scale.



css:



.hr
width: 100%;
margin:10px;
background: linear-gradient(to right, rgba(0, 0, 0, 0), rgba(0, 0, 0, 65%), rgba(0, 0, 0, 0));
border: 0;
height: 1px;
padding: 0;
font-size: 16px;
display: inline-block;



If I make height: 0.8px; with normal PC scale 100% some lines will just disappear..



P.S. Laptops is scaled 125% by default:
enter image description here










share|improve this question















Why is it like this?
enter image description here



Codepen example:
https://codepen.io/bofemptiness/pen/PxGePa?page=1&



The problem is more about why same lines are different, not a scale.



css:



.hr
width: 100%;
margin:10px;
background: linear-gradient(to right, rgba(0, 0, 0, 0), rgba(0, 0, 0, 65%), rgba(0, 0, 0, 0));
border: 0;
height: 1px;
padding: 0;
font-size: 16px;
display: inline-block;



If I make height: 0.8px; with normal PC scale 100% some lines will just disappear..



P.S. Laptops is scaled 125% by default:
enter image description here







html css






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 11 at 21:09









dmcgrandle

1,099415




1,099415










asked Nov 11 at 17:29









RTW TMI

18811




18811







  • 1




    Worked for me (Chrome/OSX). In which browser and OS are you testing ?
    – Niloct
    Nov 11 at 17:38










  • chrome. notebok. windows 10 scale 125% (standart notebok scale)
    – RTW TMI
    Nov 11 at 17:51











  • just scale and you will see the problem
    – RTW TMI
    Nov 11 at 17:53










  • Dont scale then lol
    – Lawrence Cherone
    Nov 11 at 17:58






  • 1




    you can set initial scale via meta tags to prevent it.
    – Lawrence Cherone
    Nov 11 at 18:03












  • 1




    Worked for me (Chrome/OSX). In which browser and OS are you testing ?
    – Niloct
    Nov 11 at 17:38










  • chrome. notebok. windows 10 scale 125% (standart notebok scale)
    – RTW TMI
    Nov 11 at 17:51











  • just scale and you will see the problem
    – RTW TMI
    Nov 11 at 17:53










  • Dont scale then lol
    – Lawrence Cherone
    Nov 11 at 17:58






  • 1




    you can set initial scale via meta tags to prevent it.
    – Lawrence Cherone
    Nov 11 at 18:03







1




1




Worked for me (Chrome/OSX). In which browser and OS are you testing ?
– Niloct
Nov 11 at 17:38




Worked for me (Chrome/OSX). In which browser and OS are you testing ?
– Niloct
Nov 11 at 17:38












chrome. notebok. windows 10 scale 125% (standart notebok scale)
– RTW TMI
Nov 11 at 17:51





chrome. notebok. windows 10 scale 125% (standart notebok scale)
– RTW TMI
Nov 11 at 17:51













just scale and you will see the problem
– RTW TMI
Nov 11 at 17:53




just scale and you will see the problem
– RTW TMI
Nov 11 at 17:53












Dont scale then lol
– Lawrence Cherone
Nov 11 at 17:58




Dont scale then lol
– Lawrence Cherone
Nov 11 at 17:58




1




1




you can set initial scale via meta tags to prevent it.
– Lawrence Cherone
Nov 11 at 18:03




you can set initial scale via meta tags to prevent it.
– Lawrence Cherone
Nov 11 at 18:03












1 Answer
1






active

oldest

votes

















up vote
1
down vote



accepted










On my machine (MacBook with Retina display) it looks ok as long as I have set the browser's scaling to 100%. The Retina scaling is 200%. Therefore, the lines will be exactly 2 physical pixels high and exactly fit on them.



When I modify the browser scaling, I get similar results like you. No the lines are 1.8 pixels high (at 90% scaling), 37.8 pixels apart and no longer fit on the grid of the physical pixels.



So what you're seeing is an aliasing effect that's difficult to avoid when you're close to the screens resolution. You'll have to find a different design, e.g. use wider lines and a lighter color.






share|improve this answer




















  • but why are they different from each other? They all then should be small or big.
    – RTW TMI
    Nov 11 at 17:52






  • 1




    They're different because for some of the lines, the "logical" pixels are landing squarely on the physical pixels, but on others, they're straddling two rows of physical pixels, and so they get antialiased. You could do a media query for device pixel ratio and adjust the pixel height of your hr's accordingly.
    – Thomas Peri
    Nov 11 at 18:28










  • @Thomas Peri can you give example how to do it?
    – RTW TMI
    Nov 11 at 18:40






  • 1




    Unfortunately I don't have a working way of solving your specific problem. And actually, since the scale level can be an arbitrary user-assigned number as opposed to a list of common ratios in known devices, a CSS media query won't be any help. Take a look at the value of window.devicePixelRatio in your browser using JavaScript. If its value changes according to the zoom you set, then you can divide by that number to calculate the pixel height you need. However, it probably won't work: stackoverflow.com/questions/42569455/…
    – Thomas Peri
    Nov 11 at 19:31










Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53251336%2ftotally-same-linear-gradient-lines-looks-different%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
1
down vote



accepted










On my machine (MacBook with Retina display) it looks ok as long as I have set the browser's scaling to 100%. The Retina scaling is 200%. Therefore, the lines will be exactly 2 physical pixels high and exactly fit on them.



When I modify the browser scaling, I get similar results like you. No the lines are 1.8 pixels high (at 90% scaling), 37.8 pixels apart and no longer fit on the grid of the physical pixels.



So what you're seeing is an aliasing effect that's difficult to avoid when you're close to the screens resolution. You'll have to find a different design, e.g. use wider lines and a lighter color.






share|improve this answer




















  • but why are they different from each other? They all then should be small or big.
    – RTW TMI
    Nov 11 at 17:52






  • 1




    They're different because for some of the lines, the "logical" pixels are landing squarely on the physical pixels, but on others, they're straddling two rows of physical pixels, and so they get antialiased. You could do a media query for device pixel ratio and adjust the pixel height of your hr's accordingly.
    – Thomas Peri
    Nov 11 at 18:28










  • @Thomas Peri can you give example how to do it?
    – RTW TMI
    Nov 11 at 18:40






  • 1




    Unfortunately I don't have a working way of solving your specific problem. And actually, since the scale level can be an arbitrary user-assigned number as opposed to a list of common ratios in known devices, a CSS media query won't be any help. Take a look at the value of window.devicePixelRatio in your browser using JavaScript. If its value changes according to the zoom you set, then you can divide by that number to calculate the pixel height you need. However, it probably won't work: stackoverflow.com/questions/42569455/…
    – Thomas Peri
    Nov 11 at 19:31














up vote
1
down vote



accepted










On my machine (MacBook with Retina display) it looks ok as long as I have set the browser's scaling to 100%. The Retina scaling is 200%. Therefore, the lines will be exactly 2 physical pixels high and exactly fit on them.



When I modify the browser scaling, I get similar results like you. No the lines are 1.8 pixels high (at 90% scaling), 37.8 pixels apart and no longer fit on the grid of the physical pixels.



So what you're seeing is an aliasing effect that's difficult to avoid when you're close to the screens resolution. You'll have to find a different design, e.g. use wider lines and a lighter color.






share|improve this answer




















  • but why are they different from each other? They all then should be small or big.
    – RTW TMI
    Nov 11 at 17:52






  • 1




    They're different because for some of the lines, the "logical" pixels are landing squarely on the physical pixels, but on others, they're straddling two rows of physical pixels, and so they get antialiased. You could do a media query for device pixel ratio and adjust the pixel height of your hr's accordingly.
    – Thomas Peri
    Nov 11 at 18:28










  • @Thomas Peri can you give example how to do it?
    – RTW TMI
    Nov 11 at 18:40






  • 1




    Unfortunately I don't have a working way of solving your specific problem. And actually, since the scale level can be an arbitrary user-assigned number as opposed to a list of common ratios in known devices, a CSS media query won't be any help. Take a look at the value of window.devicePixelRatio in your browser using JavaScript. If its value changes according to the zoom you set, then you can divide by that number to calculate the pixel height you need. However, it probably won't work: stackoverflow.com/questions/42569455/…
    – Thomas Peri
    Nov 11 at 19:31












up vote
1
down vote



accepted







up vote
1
down vote



accepted






On my machine (MacBook with Retina display) it looks ok as long as I have set the browser's scaling to 100%. The Retina scaling is 200%. Therefore, the lines will be exactly 2 physical pixels high and exactly fit on them.



When I modify the browser scaling, I get similar results like you. No the lines are 1.8 pixels high (at 90% scaling), 37.8 pixels apart and no longer fit on the grid of the physical pixels.



So what you're seeing is an aliasing effect that's difficult to avoid when you're close to the screens resolution. You'll have to find a different design, e.g. use wider lines and a lighter color.






share|improve this answer












On my machine (MacBook with Retina display) it looks ok as long as I have set the browser's scaling to 100%. The Retina scaling is 200%. Therefore, the lines will be exactly 2 physical pixels high and exactly fit on them.



When I modify the browser scaling, I get similar results like you. No the lines are 1.8 pixels high (at 90% scaling), 37.8 pixels apart and no longer fit on the grid of the physical pixels.



So what you're seeing is an aliasing effect that's difficult to avoid when you're close to the screens resolution. You'll have to find a different design, e.g. use wider lines and a lighter color.







share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 11 at 17:38









Codo

50.2k11110147




50.2k11110147











  • but why are they different from each other? They all then should be small or big.
    – RTW TMI
    Nov 11 at 17:52






  • 1




    They're different because for some of the lines, the "logical" pixels are landing squarely on the physical pixels, but on others, they're straddling two rows of physical pixels, and so they get antialiased. You could do a media query for device pixel ratio and adjust the pixel height of your hr's accordingly.
    – Thomas Peri
    Nov 11 at 18:28










  • @Thomas Peri can you give example how to do it?
    – RTW TMI
    Nov 11 at 18:40






  • 1




    Unfortunately I don't have a working way of solving your specific problem. And actually, since the scale level can be an arbitrary user-assigned number as opposed to a list of common ratios in known devices, a CSS media query won't be any help. Take a look at the value of window.devicePixelRatio in your browser using JavaScript. If its value changes according to the zoom you set, then you can divide by that number to calculate the pixel height you need. However, it probably won't work: stackoverflow.com/questions/42569455/…
    – Thomas Peri
    Nov 11 at 19:31
















  • but why are they different from each other? They all then should be small or big.
    – RTW TMI
    Nov 11 at 17:52






  • 1




    They're different because for some of the lines, the "logical" pixels are landing squarely on the physical pixels, but on others, they're straddling two rows of physical pixels, and so they get antialiased. You could do a media query for device pixel ratio and adjust the pixel height of your hr's accordingly.
    – Thomas Peri
    Nov 11 at 18:28










  • @Thomas Peri can you give example how to do it?
    – RTW TMI
    Nov 11 at 18:40






  • 1




    Unfortunately I don't have a working way of solving your specific problem. And actually, since the scale level can be an arbitrary user-assigned number as opposed to a list of common ratios in known devices, a CSS media query won't be any help. Take a look at the value of window.devicePixelRatio in your browser using JavaScript. If its value changes according to the zoom you set, then you can divide by that number to calculate the pixel height you need. However, it probably won't work: stackoverflow.com/questions/42569455/…
    – Thomas Peri
    Nov 11 at 19:31















but why are they different from each other? They all then should be small or big.
– RTW TMI
Nov 11 at 17:52




but why are they different from each other? They all then should be small or big.
– RTW TMI
Nov 11 at 17:52




1




1




They're different because for some of the lines, the "logical" pixels are landing squarely on the physical pixels, but on others, they're straddling two rows of physical pixels, and so they get antialiased. You could do a media query for device pixel ratio and adjust the pixel height of your hr's accordingly.
– Thomas Peri
Nov 11 at 18:28




They're different because for some of the lines, the "logical" pixels are landing squarely on the physical pixels, but on others, they're straddling two rows of physical pixels, and so they get antialiased. You could do a media query for device pixel ratio and adjust the pixel height of your hr's accordingly.
– Thomas Peri
Nov 11 at 18:28












@Thomas Peri can you give example how to do it?
– RTW TMI
Nov 11 at 18:40




@Thomas Peri can you give example how to do it?
– RTW TMI
Nov 11 at 18:40




1




1




Unfortunately I don't have a working way of solving your specific problem. And actually, since the scale level can be an arbitrary user-assigned number as opposed to a list of common ratios in known devices, a CSS media query won't be any help. Take a look at the value of window.devicePixelRatio in your browser using JavaScript. If its value changes according to the zoom you set, then you can divide by that number to calculate the pixel height you need. However, it probably won't work: stackoverflow.com/questions/42569455/…
– Thomas Peri
Nov 11 at 19:31




Unfortunately I don't have a working way of solving your specific problem. And actually, since the scale level can be an arbitrary user-assigned number as opposed to a list of common ratios in known devices, a CSS media query won't be any help. Take a look at the value of window.devicePixelRatio in your browser using JavaScript. If its value changes according to the zoom you set, then you can divide by that number to calculate the pixel height you need. However, it probably won't work: stackoverflow.com/questions/42569455/…
– Thomas Peri
Nov 11 at 19:31

















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53251336%2ftotally-same-linear-gradient-lines-looks-different%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Top Tejano songwriter Luis Silva dead of heart attack at 64

ReactJS Fetched API data displays live - need Data displayed static

政党