forked from naradesign/lcp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
62 lines (59 loc) · 3.66 KB
/
index.html
File metadata and controls
62 lines (59 loc) · 3.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>LCP - BEFORE</title>
<!-- 1. 웹 폰트 preconnect / CSS preload -->
<!-- crossorigin : 해당 요소에 링크된 외부 출처의 리소스와 현재 웹 페이와의 상호작용을 할 수 있도록 CORS(교차 출처 리소소 공유, Cross-Origin Resource Sharing)를 설정하는 속성 -->
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="preload" as="style" href="https://fonts.googleapis.com/css2?family=Noto+Sans+KR&display=swap" onload="this.onload=null;this.rel='stylesheet'">
<!-- 2.normalize 삭제 -->
<!-- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.1/normalize.css"> -->
<!-- 3. 이미지 preload -->
<link rel="preload" as="image" media="(max-width:640px)" href="https://naradesign.github.io/html5/img/small.avif">
<link rel="preload" as="image" media="(min-width:641px)" href="https://naradesign.github.io/html5/img/large.avif">
<style>
body { font-family: 'Noto Sans KR', sans-serif; }
.img {
display: block;
max-width: 100%;
height: auto;
}
.space {
height: 300vh;
text-align:center;
background:linear-gradient(#ddd 100vh, transparent 100vh) 0 0 / 100vw 200vh repeat-y
}
</style>
<!-- 4. 제이쿼리 라이브러리 삭제 -->
<!-- <script src="https://code.jquery.com/jquery-3.6.0.js"></script> -->
</head>
<body>
<h1>LCP 문제 해결하기</h1>
<p>이 페이지는 웹 사이트의 <a href="//web.dev/lcp/">LCP(Largest Contentful Paint)</a> 문제를 유발하는 큰 이미지를 포함하고 있다. 구글 크롬 <a href="//developers.google.com/web/tools/lighthouse">라이트하우스</a> 또는 <a href="//developers.google.com/speed/pagespeed/insights/?hl=ko">페이지 스피드 인사이트</a>를 통해 LCP 문제를 확인하고 개선해 보자. 이 문제를 해결하면 <a href="//developers.google.com/search/docs/guides/page-experience?hl=ko">고급 검색엔진 최적화</a>에 도움이 된다.</p>
<!-- 5. 이미지 picture 작성: 지원하는 확장자별 이미지, 디바이스별 제공 이미지 -->
<picture class="picture">
<source srcset="https://naradesign.github.io/html5/img/small.avif" type="image/avif" media="(max-width:640px)">
<source srcset="https://naradesign.github.io/html5/img/large.avif" type="image/avif">
<source srcset="https://naradesign.github.io/html5/img/small.webp" type="image/webp" media="(max-width:640px)">
<source srcset="https://naradesign.github.io/html5/img/large.webp" type="image/webp">
<img class="img" src="https://naradesign.github.io/html5/img/small.jpg" decoding="async" alt>
</picture>
<p class="space">...</p>
<!-- 6. 레이지로딩, 이미지 디코딩 병렬처리 -->
<picture class="picture">
<source srcset="https://naradesign.github.io/html5/img/example.avif" type="image/avif">
<source srcset="https://naradesign.github.io/html5/img/example.webp" type="image/webp">
<img class="img" src="https://naradesign.github.io/html5/img/example.jpg" loading="lazy" decoding="async" alt>
</picture>
<!-- 7. 제이쿼리삭제 -->
<!-- <script>
jQuery(function($){
$('img').eq(0).attr('src', 'https://naradesign.github.io/html5/img/large.jpg')
$('img').eq(1).attr('src', 'https://naradesign.github.io/html5/img/example.jpg')
})
</script> -->
</body>
</html>