Asked Aug 31st, 2021 10:16 a.m. 87 0 1
  • 87 0 1
0

Website Moblie First nên chọn cách nào để tối ưu tốc độ?

Share
  • 87 0 1

Cách 1:

#set1:before {
    position: absolute;
    background: url(../img/deco.png);
    content: '';
    background-size: 100%;
    right: -18%;
	top: -2vw;
	width: 86%;
	height: 110vw;
}
@media only screen and (min-width: 768px){
	#set1:before {
        right: auto;
		left: calc(50% - 87px);
		top: -34px;
		width: 795px;
		height: 876px;
	}
}

Cách 2:

#set1:before {
    position: absolute;
    background: url(../img/deco.png);
    content: '';
    background-size: 100%;
}
@media only screen and (max-width: 767px){
	#set1:before {
		right: -18%;
		top: -2vw;
		width: 86%;
		height: 110vw;
	}
}
@media only screen and (min-width: 768px){
	#set1:before {
		left: calc(50% - 87px);
		top: -34px;
		width: 795px;
		height: 876px;
	}
}

1 ANSWERS


Answered Aug 31st, 2021 1:34 p.m.
Accepted
+4

CSS thì liên quan gì đến tốc độ website. 2 cách trên là 2 cách để responsive thôi mà. Nếu website có khách hàng chủ yếu truy cập từ mobile thì responsive từ mobile -> desktop ngược lại website nhắm đế KH sài laptop nhiều thì ngược lại.

Muốn cải thiện tốc độ load website thì bạn tìm hiểu mấy cái như là: tối ưu hình ảnh(định dạng phù hợp, nhẹ), lazy load hình ảnh, nén file css, js, cache, ...

Xem hướng dẫn tối ưu của google trên.

google pagespeed

Screen Shot 2021-08-31 at 8.34.04 PM.png

Share
Sep 7th, 2021 12:56 p.m.
Avatar Minh Tho Nguyen @nguyenminhtho911
Nov 1st, 2021 6:38 a.m.

@pcm cảm ơn bác!!

0
| Reply
Share
Viblo
Let's register a Viblo Account to get more interesting posts.