Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
retain.css
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
郑晓
retain.css
Commits
628d5824
Commit
628d5824
authored
Nov 15, 2023
by
zhengxiao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 修复圆角边框在不同dpi下的自适应问题
parent
03bbf75b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
12 deletions
+25
-12
index.html
index.html
+12
-3
retain.css
retain.css
+13
-9
No files found.
index.html
View file @
628d5824
...
@@ -13,7 +13,13 @@
...
@@ -13,7 +13,13 @@
line-height
:
40px
;
line-height
:
40px
;
font-size
:
14px
;
font-size
:
14px
;
margin
:
20px
;
margin
:
20px
;
background-color
:
#dfdfdf
;
}
}
.btn.radius
{
border-radius
:
15px
;
}
.box
{
.box
{
width
:
375px
;
width
:
375px
;
margin
:
0
auto
;
margin
:
0
auto
;
...
@@ -22,19 +28,21 @@
...
@@ -22,19 +28,21 @@
flex-wrap
:
wrap
;
flex-wrap
:
wrap
;
}
}
[
retain
]
{
[
retain
]
{
--retain-border-color
:
#
999999
;
--retain-border-color
:
#
0048ff
;
--retain-border-radius
:
1
0
px
;
--retain-border-radius
:
1
5
px
;
}
}
</style>
</style>
</head>
</head>
<body>
<body>
<div
class=
"box"
>
<div
class=
"box"
>
<div
retain=
"border:right border:left"
class=
"btn"
>
左右边框
</div>
<div
retain=
"border:top border:bottom"
class=
"btn"
>
上下边框
</div>
<div
retain=
"border:top"
class=
"btn"
>
上边框
</div>
<div
retain=
"border:top"
class=
"btn"
>
上边框
</div>
<div
retain=
"border:bottom"
class=
"btn"
>
下边框
</div>
<div
retain=
"border:bottom"
class=
"btn"
>
下边框
</div>
<div
retain=
"border:left"
class=
"btn"
>
左边框
</div>
<div
retain=
"border:left"
class=
"btn"
>
左边框
</div>
<div
retain=
"border:right"
class=
"btn"
>
右边框
</div>
<div
retain=
"border:right"
class=
"btn"
>
右边框
</div>
<div
retain=
"border"
class=
"btn"
>
四周边框
</div>
<div
retain=
"border"
class=
"btn"
>
四周边框
</div>
<div
retain=
"round"
class=
"btn"
>
四周边框(圆角)
</div>
<div
retain=
"round"
class=
"btn
radius
"
>
四周边框(圆角)
</div>
</div>
</div>
</body>
</body>
</html>
</html>
\ No newline at end of file
retain.css
View file @
628d5824
/*retain 1px border start*/
/*retain 1px border start*/
/*
<div retain="border:top" class="btn">上边框</div>
<div retain="border:bottom" class="btn">下边框</div>
<div retain="border:left" class="btn">左边框</div>
<div retain="border:right" class="btn">右边框</div>
<div retain="border" class="btn">四周边框</div>
<div retain="round" class="btn">四周边框(圆角)</div>
*/
[
retain
]
{
[
retain
]
{
--retain-border-color
:
#d4d4d4
;
--retain-border-color
:
#d4d4d4
;
--retain-border-radius
:
40px
;
--retain-border-radius
:
40px
;
...
@@ -105,6 +96,10 @@
...
@@ -105,6 +96,10 @@
transform
:
scale
(
0.5
);
transform
:
scale
(
0.5
);
}
}
[
retain
~=
"round"
]
:after
{
border-radius
:
calc
(
var
(
--retain-border-radius
)
*
2
);
}
[
retain
~=
"border:top"
]
:before
,
[
retain
~=
"border:top"
]
:before
,
[
retain
~=
"border:left"
]
:before
,
[
retain
~=
"border:left"
]
:before
,
[
retain
~=
"border"
]
:after
,
[
retain
~=
"border"
]
:after
,
...
@@ -141,6 +136,10 @@
...
@@ -141,6 +136,10 @@
-webkit-transform
:
scale
(
0.6666
);
-webkit-transform
:
scale
(
0.6666
);
transform
:
scale
(
0.6666
);
transform
:
scale
(
0.6666
);
}
}
[
retain
~=
"round"
]
:after
{
border-radius
:
calc
(
var
(
--retain-border-radius
)
*
1.5
);
}
}
}
@media
(
-webkit-device-pixel-ratio
:
3
)
{
@media
(
-webkit-device-pixel-ratio
:
3
)
{
...
@@ -164,6 +163,10 @@
...
@@ -164,6 +163,10 @@
-webkit-transform
:
scale
(
0.3333
);
-webkit-transform
:
scale
(
0.3333
);
transform
:
scale
(
0.3333
);
transform
:
scale
(
0.3333
);
}
}
[
retain
~=
"round"
]
:after
{
border-radius
:
calc
(
var
(
--retain-border-radius
)
*
3
);
}
}
}
/* retain 1px border end */
/* retain 1px border end */
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment