Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
border hair line. border-width: 0.5px
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<title>hair line demo</title>
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no">
<link rel="stylesheet" href="./style.css"/>
</head>
<body>
<h1>hair line demo</h1>
<div class="line1"></div>
<div class="line2"></div>
<div class="line3"></div>
</body>
</html>
/**
* create hairline
*
* @param boolean $type line type (true: vertical, false: horizontal)
* @param hex $color background-color
*/
@mixin hairline($type: false, $color: null)
{
overflow: hidden;
-webkit-transform-origin: 0 0;
@if $type == false {
height: 1px;
margin-bottom: -0.5px;
-webkit-transform: scaleY(0.5);
}
@else {
width: 1px;
-webkit-transform: scaleX(0.5);
}
@if $color {
background: $color;
}
}
h1 {
font-size: 20px;
font-family: Helvetica, sans-serif;
}
.line1 {
@include hairline(false, red);
}
.line2 {
@include hairline(true, blue);
height: 100px;
}
.line3 {
@include hairline(false, black);
}
@redgoose-dev

This comment has been minimized.

Copy link
Owner Author

commented Jul 23, 2015

고해상도 환경에서 1px로 선을 만들었는데 2px로 보이는 현상이 있어 대안 중 하나.
선을 일일히 만들어줘야하는 삽질이 필요함.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.