Skip to content

Commit 0879460

Browse files
committed
Add a pure CSS device frame
1 parent ec2d0dc commit 0879460

File tree

1 file changed

+81
-0
lines changed

1 file changed

+81
-0
lines changed

src/css/custom.css

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1233,6 +1233,87 @@ code {
12331233
}
12341234
}
12351235

1236+
.device-frame {
1237+
--device-frame-bezel: 10px;
1238+
--device-frame-radius: 52px;
1239+
--device-frame-screen-radius: calc(
1240+
var(--device-frame-radius) - var(--device-frame-bezel) - 2px
1241+
);
1242+
1243+
position: relative;
1244+
display: inline-block;
1245+
isolation: isolate;
1246+
box-sizing: border-box;
1247+
max-width: 100%;
1248+
margin: var(--ifm-leading) 0;
1249+
line-height: 0;
1250+
padding: var(--device-frame-bezel);
1251+
border-radius: var(--device-frame-radius);
1252+
border: 1px solid rgba(130, 137, 145, 0.5);
1253+
background: linear-gradient(
1254+
180deg,
1255+
#3a4048 0%,
1256+
#20242b 18%,
1257+
#050608 54%,
1258+
#292d34 100%
1259+
);
1260+
box-shadow:
1261+
0 0 0 1.5px #050608,
1262+
0 8px 18px rgba(15, 23, 42, 0.12),
1263+
0 -1px 0 rgba(255, 255, 255, 0.08) inset,
1264+
1px 0 0 rgba(255, 255, 255, 0.14) inset,
1265+
-1px 0 0 rgba(255, 255, 255, 0.08) inset;
1266+
vertical-align: top;
1267+
1268+
&::before,
1269+
&::after {
1270+
content: '';
1271+
position: absolute;
1272+
z-index: -1;
1273+
width: 6px;
1274+
}
1275+
1276+
&::before {
1277+
left: -6px;
1278+
top: 112px;
1279+
height: 198px;
1280+
background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 6 198'%3E%3Crect width='6' height='30' rx='2' fill='%23171b20'/%3E%3Crect y='64' width='6' height='57' rx='2' fill='%23171b20'/%3E%3Crect y='141' width='6' height='57' rx='2' fill='%23171b20'/%3E%3C/svg%3E")
1281+
center / 100% 100% no-repeat;
1282+
filter: drop-shadow(-1px 0 0 rgba(255, 255, 255, 0.14))
1283+
drop-shadow(1px 0 0 rgba(0, 0, 0, 0.34));
1284+
}
1285+
1286+
&::after {
1287+
right: -6px;
1288+
top: 154px;
1289+
height: 84px;
1290+
background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 6 84'%3E%3Crect width='6' height='84' rx='2' fill='%23171b20'/%3E%3C/svg%3E")
1291+
center / 100% 100% no-repeat;
1292+
filter: drop-shadow(1px 0 0 rgba(255, 255, 255, 0.14))
1293+
drop-shadow(-1px 0 0 rgba(0, 0, 0, 0.34));
1294+
}
1295+
1296+
& > p {
1297+
margin: 0;
1298+
}
1299+
1300+
& > :is(img, video, .video-player),
1301+
& > p > :is(img, video, .video-player) {
1302+
display: block;
1303+
margin: 0;
1304+
overflow: hidden;
1305+
outline: none;
1306+
box-shadow: none;
1307+
border-radius: var(--device-frame-screen-radius);
1308+
clip-path: inset(0 round var(--device-frame-screen-radius));
1309+
background: #000;
1310+
}
1311+
1312+
& .video-player .video-player-icon {
1313+
border-radius: var(--device-frame-screen-radius);
1314+
}
1315+
}
1316+
12361317
.blog-wrapper {
12371318
& .container aside nav {
12381319
margin-top: 2.25rem;

0 commit comments

Comments
 (0)