所周知,CSS( 中文名稱:層疊款式表,英文全稱:Cascading Style Sheets )是一種用來(lái)體現(xiàn)HTML(規(guī)范通用符號(hào)言語(yǔ)的一個(gè)應(yīng)用)或XML(規(guī)范通用符號(hào)言語(yǔ)的一個(gè)子集)等文件款式的計(jì)算機(jī)言語(yǔ)。
CSS不只可以靜態(tài)地潤(rùn)飾網(wǎng)頁(yè),合作各種腳本言語(yǔ)動(dòng)態(tài)地對(duì)網(wǎng)頁(yè)各元素進(jìn)行格式化,咱們還可以利用CSS來(lái)制作各種各樣的圖形與形狀,包括正方形、長(zhǎng)方形、圓形、橢圓等常見形狀,甚至陰陽(yáng)八卦、太空人等圖形都能完成。下面,就讓咱們一起來(lái)看看這究竟是怎樣完成的吧。
上一篇文章跟大家介紹了十五種,這篇文章繼續(xù)跟大家介紹:
十六、五邊形
十七、六邊形
十八、八邊形
十九、心形
二十、無(wú)限符圖案
二十一、菱形
二十二、磚石盾牌
二十三、吃豆人
二十四、圓錐形
二十五、月亮
零基礎(chǔ)的想要學(xué)習(xí)HTML5技術(shù),歡迎來(lái)重慶千鋒兩周免費(fèi)試聽課程,100%面授讓你學(xué)習(xí)輕松。
SS能夠生成各種形狀。正方形和矩形很容易,因?yàn)樗鼈兪?web 的自然形狀。添加寬度和高度,就得到了所需的精確大小的矩形。添加邊框半徑,你就可以把這個(gè)形狀變成圓形,足夠多的邊框半徑,你就可以把這些矩形變成圓形和橢圓形。
我們還可以使用 CSS 偽元素中的 ::before 和 ::after,這為我們提供了向原始元素添加另外兩個(gè)形狀的可能性。通過(guò)巧妙地使用定位、轉(zhuǎn)換和許多其他技巧,我們可以只用一個(gè) HTML 元素在 CSS 中創(chuàng)建許多形狀。
雖然我們現(xiàn)在大都使用字體圖標(biāo)或者svg圖片,似乎使用 CSS 來(lái)做圖標(biāo)意義不是很大,但怎么實(shí)現(xiàn)這些圖標(biāo)用到的一些技巧及思路是很值得我們的學(xué)習(xí)。
1.正方形
#square { width: 100px; height: 100px; background: red; }
2.長(zhǎng)方形
#rectangle { width: 200px; height: 100px; background: red; }
3.圓形
#circle { width: 100px; height: 100px; background: red; border-radius: 50% }
4.橢圓形
#oval { width: 200px; height: 100px; background: red; border-radius: 100px / 50px; }
5.上三角
#triangle-up { width: 0; height: 0; border-left: 50px solid transparent; border-right: 50px solid transparent; border-bottom: 100px solid red; }
6.下三角
#triangle-down { width: 0; height: 0; border-left: 50px solid transparent; border-right: 50px solid transparent; border-top: 100px solid red; }
7.左三角
#triangle-left { width: 0; height: 0; border-top: 50px solid transparent; border-right: 100px solid red; border-bottom: 50px solid transparent; }
8.右三角
#triangle-right { width: 0; height: 0; border-top: 50px solid transparent; border-left: 100px solid red; border-bottom: 50px solid transparent; }
9.左上角
#triangle-topleft { width: 0; height: 0; border-top: 100px solid red; border-right: 100px solid transparent; }
10.右上角
#triangle-topright { width: 0; height: 0; border-top: 100px solid red; border-left: 100px solid transparent; }
11.左下角
#triangle-bottomleft { width: 0; height: 0; border-bottom: 100px solid red; border-right: 100px solid transparent; }
12.右下角
#triangle-bottomright { width: 0; height: 0; border-bottom: 100px solid red; border-left: 100px solid transparent; }
13.箭頭
#curvedarrow { position: relative; width: 0; height: 0; border-top: 9px solid transparent; border-right: 9px solid red; transform: rotate(10deg); } #curvedarrow:after { content: ""; position: absolute; border: 0 solid transparent; border-top: 3px solid red; border-radius: 20px 0 0 0; top: -12px; left: -9px; width: 12px; height: 12px; transform: rotate(45deg); }
14.梯形
#trapezoid { border-bottom: 100px solid red; border-left: 25px solid transparent; border-right: 25px solid transparent; height: 0; width: 100px; }
15.平行四邊形
#parallelogram { width: 150px; height: 100px; transform: skew(20deg); background: red; }
16.星星 (6角)
#star-six { width: 0; height: 0; border-left: 50px solid transparent; border-right: 50px solid transparent; border-bottom: 100px solid red; position: relative; } #star-six:after { width: 0; height: 0; border-left: 50px solid transparent; border-right: 50px solid transparent; border-top: 100px solid red; position: absolute; content: ""; top: 30px; left: -50px; }
17.星星 (5角)
#star-five { margin: 50px 0; position: relative; display: block; color: red; width: 0px; height: 0px; border-right: 100px solid transparent; border-bottom: 70px solid red; border-left: 100px solid transparent; transform: rotate(35deg); } #star-five:before { border-bottom: 80px solid red; border-left: 30px solid transparent; border-right: 30px solid transparent; position: absolute; height: 0; width: 0; top: -45px; left: -65px; display: block; content: ''; transform: rotate(-35deg); } #star-five:after { position: absolute; display: block; color: red; top: 3px; left: -105px; width: 0px; height: 0px; border-right: 100px solid transparent; border-bottom: 70px solid red; border-left: 100px solid transparent; transform: rotate(-70deg); content: ''; }
18.五邊形
#pentagon { position: relative; width: 54px; box-sizing: content-box; border-width: 50px 18px 0; border-style: solid; border-color: red transparent; } #pentagon:before { content: ""; position: absolute; height: 0; width: 0; top: -85px; left: -18px; border-width: 0 45px 35px; border-style: solid; border-color: transparent transparent red; }
19.六邊形
#hexagon { width: 100px; height: 55px; background: red; position: relative; } #hexagon:before { content: ""; position: absolute; top: -25px; left: 0; width: 0; height: 0; border-left: 50px solid transparent; border-right: 50px solid transparent; border-bottom: 25px solid red; } #hexagon:after { content: ""; position: absolute; bottom: -25px; left: 0; width: 0; height: 0; border-left: 50px solid transparent; border-right: 50px solid transparent; border-top: 25px solid red; }
20.八邊形
#octagon { width: 100px; height: 100px; background: red; position: relative; } #octagon:before { content: ""; width: 100px; height: 0; position: absolute; top: 0; left: 0; border-bottom: 29px solid red; border-left: 29px solid #eee; border-right: 29px solid #eee; } #octagon:after { content: ""; width: 100px; height: 0; position: absolute; bottom: 0; left: 0; border-top: 29px solid red; border-left: 29px solid #eee; border-right: 29px solid #eee; }
21.愛心
#heart { position: relative; width: 100px; height: 90px; } #heart:before, #heart:after { position: absolute; content: ""; left: 50px; top: 0; width: 50px; height: 80px; background: red; border-radius: 50px 50px 0 0; transform: rotate(-45deg); transform-origin: 0 100%; } #heart:after { left: 0; transform: rotate(45deg); transform-origin: 100% 100%; }
22.無(wú)窮大
#infinity { position: relative; width: 212px; height: 100px; box-sizing: content-box; } #infinity:before, #infinity:after { content: ""; box-sizing: content-box; position: absolute; top: 0; left: 0; width: 60px; height: 60px; border: 20px solid red; border-radius: 50px 50px 0 50px; transform: rotate(-45deg); } #infinity:after { left: auto; right: 0; border-radius: 50px 50px 50px 0; transform: rotate(45deg); }
23.菱形
#diamond { width: 0; height: 0; border: 50px solid transparent; border-bottom-color: red; position: relative; top: -50px; } #diamond:after { content: ''; position: absolute; left: -50px; top: 50px; width: 0; height: 0; border: 50px solid transparent; border-top-color: red; }
代碼部署后可能存在的BUG沒法實(shí)時(shí)知道,事后為了解決這些BUG,花了大量的時(shí)間進(jìn)行l(wèi)og 調(diào)試,這邊順便給大家推薦一個(gè)好用的BUG監(jiān)控工具 Fundebug。
24.鉆石1
#diamond-shield { width: 0; height: 0; border: 50px solid transparent; border-bottom: 20px solid red; position: relative; top: -50px; } #diamond-shield:after { content: ''; position: absolute; left: -50px; top: 20px; width: 0; height: 0; border: 50px solid transparent; border-top: 70px solid red; }
25.鉆石2
#cut-diamond { border-style: solid; border-color: transparent transparent red transparent; border-width: 0 25px 25px 25px; height: 0; width: 50px; box-sizing: content-box; position: relative; margin: 20px 0 50px 0; } #cut-diamond:after { content: ""; position: absolute; top: 25px; left: -25px; width: 0; height: 0; border-style: solid; border-color: red transparent transparent transparent; border-width: 70px 50px 0 50px; }
26.鉆戒
#diamond-narrow { width: 0; height: 0; border: 50px solid transparent; border-bottom: 70px solid red; position: relative; top: -50px; } #diamond-narrow:after { content: ''; position: absolute; left: -50px; top: 70px; width: 0; height: 0; border: 50px solid transparent; border-top: 70px solid red; }
27. 雞蛋
#egg { display: block; width: 126px; height: 180px; background-color: red; border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; }
28.吃豆人
#pacman { width: 0px; height: 0px; border-right: 60px solid transparent; border-top: 60px solid red; border-left: 60px solid red; border-bottom: 60px solid red; border-top-left-radius: 60px; border-top-right-radius: 60px; border-bottom-left-radius: 60px; border-bottom-right-radius: 60px; }
29.對(duì)話泡泡
#talkbubble { width: 120px; height: 80px; background: red; position: relative; -moz-border-radius: 10px; -webkit-border-radius: 10px; border-radius: 10px; } #talkbubble:before { content: ""; position: absolute; right: 100%; top: 26px; width: 0; height: 0; border-top: 13px solid transparent; border-right: 26px solid red; border-bottom: 13px solid transparent; }
30. 12點(diǎn) 爆發(fā)
#burst-12 { background: red; width: 80px; height: 80px; position: relative; text-align: center; } #burst-12:before, #burst-12:after { content: ""; position: absolute; top: 0; left: 0; height: 80px; width: 80px; background: red; } #burst-12:before { transform: rotate(30deg); } #burst-12:after { transform: rotate(60deg); }
31. 8點(diǎn) 爆發(fā)
#burst-8 { background: red; width: 80px; height: 80px; position: relative; text-align: center; transform: rotate(20deg); } #burst-8:before { content: ""; position: absolute; top: 0; left: 0; height: 80px; width: 80px; background: red; transform: rotate(135deg); }
32.太極
#yin-yang { width: 96px; box-sizing: content-box; height: 48px; background: #eee; border-color: red; border-style: solid; border-width: 2px 2px 50px 2px; border-radius: 100%; position: relative; } #yin-yang:before { content: ""; position: absolute; top: 50%; left: 0; background: #eee; border: 18px solid red; border-radius: 100%; width: 12px; height: 12px; box-sizing: content-box; } #yin-yang:after { content: ""; position: absolute; top: 50%; left: 50%; background: red; border: 18px solid #eee; border-radius: 100%; width: 12px; height: 12px; box-sizing: content-box; }
33.徽章絲帶
#badge-ribbon { position: relative; background: red; height: 100px; width: 100px; border-radius: 50px; } #badge-ribbon:before, #badge-ribbon:after { content: ''; position: absolute; border-bottom: 70px solid red; border-left: 40px solid transparent; border-right: 40px solid transparent; top: 70px; left: -10px; transform: rotate(-140deg); } #badge-ribbon:after { left: auto; right: -10px; transform: rotate(140deg); }
34.太空入侵者(電腦游戲名)
#space-invader { box-shadow: 0 0 0 1em red, 0 1em 0 1em red, -2.5em 1.5em 0 .5em red, 2.5em 1.5em 0 .5em red, -3em -3em 0 0 red, 3em -3em 0 0 red, -2em -2em 0 0 red, 2em -2em 0 0 red, -3em -1em 0 0 red, -2em -1em 0 0 red, 2em -1em 0 0 red, 3em -1em 0 0 red, -4em 0 0 0 red, -3em 0 0 0 red, 3em 0 0 0 red, 4em 0 0 0 red, -5em 1em 0 0 red, -4em 1em 0 0 red, 4em 1em 0 0 red, 5em 1em 0 0 red, -5em 2em 0 0 red, 5em 2em 0 0 red, -5em 3em 0 0 red, -3em 3em 0 0 red, 3em 3em 0 0 red, 5em 3em 0 0 red, -2em 4em 0 0 red, -1em 4em 0 0 red, 1em 4em 0 0 red, 2em 4em 0 0 red; background: red; width: 1em; height: 1em; overflow: hidden; margin: 50px 0 70px 65px; }
35.電視
#tv { position: relative; width: 200px; height: 150px; margin: 20px 0; background: red; border-radius: 50% / 10%; color: white; text-align: center; text-indent: .1em; } #tv:before { content: ''; position: absolute; top: 10%; bottom: 10%; right: -5%; left: -5%; background: inherit; border-radius: 5% / 50%; }
36.雪佛龍
#chevron { position: relative; text-align: center; padding: 12px; margin-bottom: 6px; height: 60px; width: 200px; } #chevron:before { content: ''; position: absolute; top: 0; left: 0; height: 100%; width: 51%; background: red; transform: skew(0deg, 6deg); } #chevron:after { content: ''; position: absolute; top: 0; right: 0; height: 100%; width: 50%; background: red; transform: skew(0deg, -6deg); }
37.放大鏡
#magnifying-glass { font-size: 10em; display: inline-block; width: 0.4em; box-sizing: content-box; height: 0.4em border: 0.1em solid red; position: relative; border-radius: 0.35em; } #magnifying-glass:before { content: ""; display: inline-block; position: absolute; right: -0.25em; bottom: -0.1em; border-width: 0; background: red; width: 0.35em; height: 0.08em; transform: rotate(45deg); }
38.Facebook圖標(biāo)
#facebook-icon { background: red; text-indent: -999em; width: 100px; height: 110px; box-sizing: content-box; border-radius: 5px; position: relative; overflow: hidden; border: 15px solid red; border-bottom: 0; } #facebook-icon:before { content: "/20"; position: absolute; background: red; width: 40px; height: 90px; bottom: -30px; right: -37px; border: 20px solid #eee; border-radius: 25px; box-sizing: content-box; } #facebook-icon:after { content: "/20"; position: absolute; width: 55px; top: 50px; height: 20px; background: #eee; right: 5px; box-sizing: content-box; }
39.月亮
#moon { width: 80px; height: 80px; border-radius: 50%; box-shadow: 15px 15px 0 0 red; }
40.旗
#flag { width: 110px; height: 56px; box-sizing: content-box; padding-top: 15px; position: relative; background: red; color: white; font-size: 11px; letter-spacing: 0.2em; text-align: center; text-transform: uppercase; } #flag:after { content: ""; position: absolute; left: 0; bottom: 0; width: 0; height: 0; border-bottom: 13px solid #eee; border-left: 55px solid transparent; border-right: 55px solid transparent; }
41.圓錐
#cone { width: 0; height: 0; border-left: 70px solid transparent; border-right: 70px solid transparent; border-top: 100px solid red; border-radius: 50%; }
42.十字架
#cross { background: red; height: 100px; position: relative; width: 20px; } #cross:after { background: red; content: ""; height: 20px; left: -40px; position: absolute; top: 40px; width: 100px; }
43.根基
#base { background: red; display: inline-block; height: 55px; margin-left: 20px; margin-top: 55px; position: relative; width: 100px; } #base:before { border-bottom: 35px solid red; border-left: 50px solid transparent; border-right: 50px solid transparent; content: ""; height: 0; left: 0; position: absolute; top: -35px; width: 0; }
44.指示器
#pointer { width: 200px; height: 40px; position: relative; background: red; } #pointer:after { content: ""; position: absolute; left: 0; bottom: 0; width: 0; height: 0; border-left: 20px solid white; border-top: 20px solid transparent; border-bottom: 20px solid transparent; } #pointer:before { content: ""; position: absolute; right: -20px; bottom: 0; width: 0; height: 0; border-left: 20px solid red; border-top: 20px solid transparent; border-bottom: 20px solid transparent; }
45.鎖
篇
前端開發(fā)是一個(gè)非常特殊的行業(yè),它的歷史實(shí)際上不是很長(zhǎng),但是知識(shí)之繁雜,技術(shù)迭代速度之快是其他技術(shù)所不能比擬的。
winter在他的《重學(xué)前端》課程中提到:
到現(xiàn)在為止,前端工程師已經(jīng)成為研發(fā)體系中的重要崗位之一。可是,與此相對(duì)的是,我發(fā)現(xiàn)極少或者幾乎沒有大學(xué)的計(jì)算機(jī)專業(yè)愿意開設(shè)前端課程,更沒有系統(tǒng)性的教學(xué)方案出現(xiàn)。大部分前端工程師的知識(shí),其實(shí)都是來(lái)自于實(shí)踐和工作中零散的學(xué)習(xí)。
這樣是一個(gè)非常真實(shí)的現(xiàn)狀,實(shí)際上很多前端開發(fā)者都是自學(xué)甚至轉(zhuǎn)行過(guò)來(lái)的,前端入門簡(jiǎn)單,學(xué)習(xí)了幾個(gè)API以后上手做項(xiàng)目也很簡(jiǎn)單,但是這往往成為了限制自身發(fā)展的瓶頸。
只是停留在會(huì)用階段是遠(yuǎn)遠(yuǎn)不夠的,我們還需要不斷探索和深入。現(xiàn)在市面上并不缺少學(xué)習(xí)教程,技術(shù)文章,如果盲目的學(xué)習(xí)你會(huì)發(fā)現(xiàn)看過(guò)以后的知識(shí)留存率會(huì)很低,而且發(fā)現(xiàn)沒有了解到的知識(shí)越來(lái)越多,這會(huì)讓人產(chǎn)生焦慮。
實(shí)際上,除了堅(jiān)持學(xué)習(xí)的強(qiáng)大的自驅(qū)力,你還需要一個(gè)很簡(jiǎn)單的學(xué)習(xí)方法。那就是:建立自己的知識(shí)體系。它能幫助你更系統(tǒng)性的學(xué)習(xí),同時(shí)你也時(shí)刻能知道自己哪些地方是不足的。
我會(huì)把我工作和學(xué)習(xí)中接觸到的知識(shí)全部歸納到我的知識(shí)體系中,其中不僅僅包括我已經(jīng)學(xué)過(guò)的,還有很多我沒有來(lái)得及學(xué)習(xí)的。
這不僅僅是我的知識(shí)體系,更是我時(shí)刻提醒自己的自檢清單。
下面我會(huì)把我的自檢清單分享給大家,你可以按照清單上的知識(shí)檢測(cè)自己還有哪些不足和提升,我也建議大家建自己的知識(shí)體系,這樣工作或者學(xué)習(xí)甚至面試時(shí),你能快速定位到知識(shí)清單中的點(diǎn),如果你有哪些我沒歸納到的點(diǎn),歡迎在評(píng)論區(qū)告訴我。
一、JavaScript基礎(chǔ)
前端工程師吃飯的家伙,深度、廣度一樣都不能差。
變量和類型
1.JavaScript規(guī)定了幾種語(yǔ)言類型
2.JavaScript對(duì)象的底層數(shù)據(jù)結(jié)構(gòu)是什么
3.Symbol類型在實(shí)際開發(fā)中的應(yīng)用、可手動(dòng)實(shí)現(xiàn)一個(gè)簡(jiǎn)單的Symbol
4.JavaScript中的變量在內(nèi)存中的具體存儲(chǔ)形式
5.基本類型對(duì)應(yīng)的內(nèi)置對(duì)象,以及他們之間的裝箱拆箱操作
6.理解值類型和引用類型
7.null和undefined的區(qū)別
8.至少可以說(shuō)出三種判斷JavaScript數(shù)據(jù)類型的方式,以及他們的優(yōu)缺點(diǎn),如何準(zhǔn)確的 判斷數(shù)組類型
9.可能發(fā)生隱式類型轉(zhuǎn)換的場(chǎng)景以及轉(zhuǎn)換原則,應(yīng)如何避免或巧妙應(yīng)用
10.出現(xiàn)小數(shù)精度丟失的原因,JavaScript可以存儲(chǔ)的最大數(shù)字、最大安全數(shù)字。JavaScript處理大數(shù)字的方法、避免精度丟失的方法
原型和原型鏈
1.理解原型設(shè)計(jì)模式以及JavaScript中的原型規(guī)則
2.instanceof的底層實(shí)現(xiàn)原理,手動(dòng)實(shí)現(xiàn)一個(gè)instanceof
4.實(shí)現(xiàn)繼承的幾種方式以及他們的優(yōu)缺點(diǎn)
5.至少說(shuō)出一種開源項(xiàng)目(如Node)中應(yīng)用原型繼承的案例
6.可以描述new一個(gè)對(duì)象的詳細(xì)過(guò)程,手動(dòng)實(shí)現(xiàn)一個(gè)new操作符
7.理解es6 class構(gòu)造以及繼承的底層實(shí)現(xiàn)原理
作用域和閉包
1.理解詞法作用域和動(dòng)態(tài)作用域
2.理解JavaScript的作用域和作用域鏈
3.理解JavaScript的執(zhí)行上下文棧,可以應(yīng)用堆棧信息快速定位問(wèn)題
4.this的原理以及幾種不同使用場(chǎng)景的取值
5.閉包的實(shí)現(xiàn)原理和作用,可以列舉幾個(gè)開發(fā)中閉包的實(shí)際應(yīng)用
6.理解堆棧溢出和內(nèi)存泄漏的原理,如何防止
7.如何處理循環(huán)的異步操作
8.理解模塊化解決的實(shí)際問(wèn)題,可列舉幾個(gè)模塊化方案并理解其中原理
執(zhí)行機(jī)制
1.為何try里面放return,finally還會(huì)執(zhí)行,理解其內(nèi)部機(jī)制
2.JavaScript如何實(shí)現(xiàn)異步編程,可以詳細(xì)描述EventLoop機(jī)制
3.宏任務(wù)和微任務(wù)分別有哪些
4.可以快速分析一個(gè)復(fù)雜的異步嵌套邏輯,并掌握分析方法
5.使用Promise實(shí)現(xiàn)串行
6.Node與瀏覽器EventLoop的差異
7.如何在保證頁(yè)面運(yùn)行流暢的情況下處理海量數(shù)據(jù)
語(yǔ)法和API
1.理解ECMAScript和JavaScript的關(guān)系
2.熟練運(yùn)用es5、es6提供的語(yǔ)法規(guī)范,
3.熟練掌握J(rèn)avaScript提供的全局對(duì)象(例如Date、Math)、全局函數(shù)(例如decodeURI、isNaN)、全局屬性(例如Infinity、undefined)
4.熟練應(yīng)用map、reduce、filter 等高階函數(shù)解決問(wèn)題
5.setInterval需要注意的點(diǎn),使用settimeout實(shí)現(xiàn)setInterval
6.JavaScript提供的正則表達(dá)式API、可以使用正則表達(dá)式(郵箱校驗(yàn)、URL解析、去重等)解決常見問(wèn)題
7.JavaScript異常處理的方式,統(tǒng)一的異常處理方案
二、HTML和CSS
HTML
1.從規(guī)范的角度理解HTML,從分類和語(yǔ)義的角度使用標(biāo)簽
2.常用頁(yè)面標(biāo)簽的默認(rèn)樣式、自帶屬性、不同瀏覽器的差異、處理瀏覽器兼容問(wèn)題的方式
3.元信息類標(biāo)簽(head、title、meta)的使用目的和配置方法
4.HTML5離線緩存原理
5.可以使用Canvas API、SVG等繪制高性能的動(dòng)畫
CSS
1.CSS盒模型,在不同瀏覽器的差異
2.CSS所有選擇器及其優(yōu)先級(jí)、使用場(chǎng)景,哪些可以繼承,如何運(yùn)用at規(guī)則
3.CSS偽類和偽元素有哪些,它們的區(qū)別和實(shí)際應(yīng)用
4.HTML文檔流的排版規(guī)則,CSS幾種定位的規(guī)則、定位參照物、對(duì)文檔流的影響,如何選擇最好的定位方式,雪碧圖實(shí)現(xiàn)原理
5.水平垂直居中的方案、可以實(shí)現(xiàn)6種以上并對(duì)比它們的優(yōu)缺點(diǎn)
6.BFC實(shí)現(xiàn)原理,可以解決的問(wèn)題,如何創(chuàng)建BFC
7.可使用CSS函數(shù)復(fù)用代碼,實(shí)現(xiàn)特殊效果
8.PostCSS、Sass、Less的異同,以及使用配置,至少掌握一種
9.CSS模塊化方案、如何配置按需加載、如何防止CSS阻塞渲染
10.熟練使用CSS實(shí)現(xiàn)常見動(dòng)畫,如漸變、移動(dòng)、旋轉(zhuǎn)、縮放等等
11.CSS瀏覽器兼容性寫法,了解不同API在不同瀏覽器下的兼容性情況
12.掌握一套完整的響應(yīng)式布局方案
手寫
1.手寫圖片瀑布流效果
2.使用CSS繪制幾何圖形(圓形、三角形、扇形、菱形等)
3.使用純CSS實(shí)現(xiàn)曲線運(yùn)動(dòng)(貝塞爾曲線)
4.實(shí)現(xiàn)常用布局(三欄、圣杯、雙飛翼、吸頂),可是說(shuō)出多種方式并理解其優(yōu)缺點(diǎn)
三、計(jì)算機(jī)基礎(chǔ)
關(guān)于編譯原理,不需要理解非常深入,但是最基本的原理和概念一定要懂,這對(duì)于學(xué)習(xí)一門編程語(yǔ)言非常重要
編譯原理
1.理解代碼到底是什么,計(jì)算機(jī)如何將代碼轉(zhuǎn)換為可以運(yùn)行的目標(biāo)程序
2.正則表達(dá)式的匹配原理和性能優(yōu)化
3.如何將JavaScript代碼解析成抽象語(yǔ)法樹(AST)
4.base64的編碼原理
5.幾種進(jìn)制的相互轉(zhuǎn)換計(jì)算方法,在JavaScript中如何表示和轉(zhuǎn)換
網(wǎng)絡(luò)協(xié)議
1.理解什么是協(xié)議,了解TCP/IP網(wǎng)絡(luò)協(xié)議族的構(gòu)成,每層協(xié)議在應(yīng)用程序中發(fā)揮的作用
2.三次握手和四次揮手詳細(xì)原理,為什么要使用這種機(jī)制
3.有哪些協(xié)議是可靠,TCP有哪些手段保證可靠交付
4.DNS的作用、DNS解析的詳細(xì)過(guò)程,DNS優(yōu)化原理
5.CDN的作用和原理
6.HTTP請(qǐng)求報(bào)文和響應(yīng)報(bào)文的具體組成,能理解常見請(qǐng)求頭的含義,有幾種請(qǐng)求方式,區(qū)別是什么
7.HTTP所有狀態(tài)碼的具體含義,看到異常狀態(tài)碼能快速定位問(wèn)題
8.HTTP1.1、HTTP2.0帶來(lái)的改變
9.HTTPS的加密原理,如何開啟HTTPS,如何劫持HTTPS請(qǐng)求
10.理解WebSocket協(xié)議的底層原理、與HTTP的區(qū)別
設(shè)計(jì)模式
1.熟練使用前端常用的設(shè)計(jì)模式編寫代碼,如單例模式、裝飾器模式、代理模式等
2.發(fā)布訂閱模式和觀察者模式的異同以及實(shí)際應(yīng)用
3.可以說(shuō)出幾種設(shè)計(jì)模式在開發(fā)中的實(shí)際應(yīng)用,理解框架源碼中對(duì)設(shè)計(jì)模式的應(yīng)用
四、數(shù)據(jù)結(jié)構(gòu)和算法
據(jù)我了解的大部分前端對(duì)這部分知識(shí)有些欠缺,甚至抵觸,但是,如果突破更高的天花板,這部分知識(shí)是必不可少的,而且我親身經(jīng)歷——非常有用!
JavaScript編碼能力
1.多種方式實(shí)現(xiàn)數(shù)組去重、扁平化、對(duì)比優(yōu)缺點(diǎn)
2.多種方式實(shí)現(xiàn)深拷貝、對(duì)比優(yōu)缺點(diǎn)
3.手寫函數(shù)柯里化工具函數(shù)、并理解其應(yīng)用場(chǎng)景和優(yōu)勢(shì)
4.手寫防抖和節(jié)流工具函數(shù)、并理解其內(nèi)部原理和應(yīng)用場(chǎng)景
5.實(shí)現(xiàn)一個(gè)sleep函數(shù)
手動(dòng)實(shí)現(xiàn)前端輪子
1.手動(dòng)實(shí)現(xiàn)call、apply、bind
2.手動(dòng)實(shí)現(xiàn)符合Promise/A+規(guī)范的Promise、手動(dòng)實(shí)現(xiàn)async await
3.手寫一個(gè)EventEmitter實(shí)現(xiàn)事件發(fā)布、訂閱
4.可以說(shuō)出兩種實(shí)現(xiàn)雙向綁定的方案、可以手動(dòng)實(shí)現(xiàn)
5.手寫JSON.stringify、JSON.parse
6.手寫一個(gè)模版引擎,并能解釋其中原理
7.手寫懶加載、下拉刷新、上拉加載、預(yù)加載等效果
數(shù)據(jù)結(jié)構(gòu)
1.理解常見數(shù)據(jù)結(jié)構(gòu)的特點(diǎn),以及他們?cè)诓煌瑘?chǎng)景下使用的優(yōu)缺點(diǎn)
2.理解數(shù)組、字符串的存儲(chǔ)原理,并熟練應(yīng)用他們解決問(wèn)題
3.理解二叉樹、棧、隊(duì)列、哈希表的基本結(jié)構(gòu)和特點(diǎn),并可以應(yīng)用它解決問(wèn)題
4.了解圖、堆的基本結(jié)構(gòu)和使用場(chǎng)景
算法
1.可計(jì)算一個(gè)算法的時(shí)間復(fù)雜度和空間復(fù)雜度,可估計(jì)業(yè)務(wù)邏輯代碼的耗時(shí)和內(nèi)存消耗
2.至少理解五種排序算法的實(shí)現(xiàn)原理、應(yīng)用場(chǎng)景、優(yōu)缺點(diǎn),可快速說(shuō)出時(shí)間、空間復(fù)雜度
3.了解遞歸和循環(huán)的優(yōu)缺點(diǎn)、應(yīng)用場(chǎng)景、并可在開發(fā)中熟練應(yīng)用
4.可應(yīng)用回溯算法、貪心算法、分治算法、動(dòng)態(tài)規(guī)劃等解決復(fù)雜問(wèn)題
5.前端處理海量數(shù)據(jù)的算法方案
五、運(yùn)行環(huán)境
我們需要理清語(yǔ)言和環(huán)境的關(guān)系:
ECMAScript描述了JavaScript語(yǔ)言的語(yǔ)法和基本對(duì)象規(guī)范
瀏覽器作為JavaScript的一種運(yùn)行環(huán)境,為它提供了:文檔對(duì)象模型(DOM),描述處理網(wǎng)頁(yè)內(nèi)容的方法和接口、瀏覽器對(duì)象模型(BOM),描述與瀏覽器進(jìn)行交互的方法和接口
Node也是JavaScript的一種運(yùn)行環(huán)境,為它提供了操作I/O、網(wǎng)絡(luò)等API
瀏覽器API
1.瀏覽器提供的符合W3C標(biāo)準(zhǔn)的DOM操作API、瀏覽器差異、兼容性
2.瀏覽器提供的瀏覽器對(duì)象模型 (BOM)提供的所有全局API、瀏覽器差異、兼容性
3.大量DOM操作、海量數(shù)據(jù)的性能優(yōu)化(合并操作、Diff、requestAnimationFrame等)
4.瀏覽器海量數(shù)據(jù)存儲(chǔ)、操作性能優(yōu)化
5.DOM事件流的具體實(shí)現(xiàn)機(jī)制、不同瀏覽器的差異、事件代理
6.前端發(fā)起網(wǎng)絡(luò)請(qǐng)求的幾種方式及其底層實(shí)現(xiàn)、可以手寫原生ajax、fetch、可以熟練使用第三方庫(kù)
7.瀏覽器的同源策略,如何避免同源策略,幾種方式的異同點(diǎn)以及如何選型
8.瀏覽器提供的幾種存儲(chǔ)機(jī)制、優(yōu)缺點(diǎn)、開發(fā)中正確的選擇
9.瀏覽器跨標(biāo)簽通信
瀏覽器原理
1.各瀏覽器使用的JavaScript引擎以及它們的異同點(diǎn)、如何在代碼中進(jìn)行區(qū)分
2.請(qǐng)求數(shù)據(jù)到請(qǐng)求結(jié)束與服務(wù)器進(jìn)行了幾次交互
3.可詳細(xì)描述瀏覽器從輸入U(xiǎn)RL到頁(yè)面展現(xiàn)的詳細(xì)過(guò)程
4.瀏覽器解析HTML代碼的原理,以及構(gòu)建DOM樹的流程
5.瀏覽器如何解析CSS規(guī)則,并將其應(yīng)用到DOM樹上
6.瀏覽器如何將解析好的帶有樣式的DOM樹進(jìn)行繪制
7.瀏覽器的運(yùn)行機(jī)制,如何配置資源異步同步加載
8.瀏覽器回流與重繪的底層原理,引發(fā)原因,如何有效避免
9.瀏覽器的垃圾回收機(jī)制,如何避免內(nèi)存泄漏
10.瀏覽器采用的緩存方案,如何選擇和控制合適的緩存方案
Node
1.理解Node在應(yīng)用程序中的作用,可以使用Node搭建前端運(yùn)行環(huán)境、使用Node操作文件、操作數(shù)據(jù)庫(kù)等等
2.掌握一種Node開發(fā)框架,如Express,Express和Koa的區(qū)別
3.熟練使用Node提供的API如Path、Http、Child Process等并理解其實(shí)現(xiàn)原理
4.Node的底層運(yùn)行原理、和瀏覽器的異同
5.Node事件驅(qū)動(dòng)、非阻塞機(jī)制的實(shí)現(xiàn)原理
六、框架和類庫(kù)
輪子層出不窮,從原理上理解才是正道
TypeScript
1.理解泛型、接口等面向?qū)ο蟮南嚓P(guān)概念,TypeScript對(duì)面向?qū)ο罄砟畹膶?shí)現(xiàn)
2.理解使用TypeScript的好處,掌握TypeScript基礎(chǔ)語(yǔ)法
3.TypeScript的規(guī)則檢測(cè)原理
4.可以在React、Vue等框架中使用TypeScript進(jìn)行開發(fā)
React
1.React和vue選型和優(yōu)缺點(diǎn)、核心架構(gòu)的區(qū)別
2.React中setState的執(zhí)行機(jī)制,如何有效的管理狀態(tài)
3.React的事件底層實(shí)現(xiàn)機(jī)制
4.React的虛擬DOM和Diff算法的內(nèi)部實(shí)現(xiàn)
5.React的Fiber工作原理,解決了什么問(wèn)題
6.React Router和Vue Router的底層實(shí)現(xiàn)原理、動(dòng)態(tài)加載實(shí)現(xiàn)原理
7.可熟練應(yīng)用React API、生命周期等,可應(yīng)用HOC、render props、Hooks等高階用法解決問(wèn)題
8.基于React的特性和原理,可以手動(dòng)實(shí)現(xiàn)一個(gè)簡(jiǎn)單的React
Vue
1.熟練使用Vue的API、生命周期、鉤子函數(shù)
2.MVVM框架設(shè)計(jì)理念
3.Vue雙向綁定實(shí)現(xiàn)原理、Diff算法的內(nèi)部實(shí)現(xiàn)
4.Vue的事件機(jī)制
5.從template轉(zhuǎn)換成真實(shí)DOM的實(shí)現(xiàn)機(jī)制
多端開發(fā)
2.單頁(yè)面應(yīng)用(SPA)的原理和優(yōu)缺點(diǎn),掌握一種快速開發(fā)SPA的方案
3.理解Viewport、em、rem的原理和用法,分辨率、px、ppi、dpi、dp的區(qū)別和實(shí)際應(yīng)用
3.移動(dòng)端頁(yè)面適配解決方案、不同機(jī)型適配方案
4.掌握一種JavaScript移動(dòng)客戶端開發(fā)技術(shù),如React Native:可以搭建React Native開發(fā)環(huán)境,熟練進(jìn)行開發(fā),可理解React Native的運(yùn)作原理,不同端適配
5.掌握一種JavaScript PC客戶端開發(fā)技術(shù),如Electron:可搭建Electron開發(fā)環(huán)境,熟練進(jìn)行開發(fā),可理解Electron的運(yùn)作原理
6.掌握一種小程序開發(fā)框架或原生小程序開發(fā)
7.理解多端框架的內(nèi)部實(shí)現(xiàn)原理,至少了解一個(gè)多端框架的使用
數(shù)據(jù)流管理
1.掌握React和Vue傳統(tǒng)的跨組件通信方案,對(duì)比采用數(shù)據(jù)流管理框架的異同
2.熟練使用Redux管理數(shù)據(jù)流,并理解其實(shí)現(xiàn)原理,中間件實(shí)現(xiàn)原理
3.熟練使用Mobx管理數(shù)據(jù)流,并理解其實(shí)現(xiàn)原理,相比Redux有什么優(yōu)勢(shì)
4.熟練使用Vuex管理數(shù)據(jù)流,并理解其實(shí)現(xiàn)原理
5.以上數(shù)據(jù)流方案的異同和優(yōu)缺點(diǎn),不情況下的技術(shù)選型
實(shí)用庫(kù)
1.至少掌握一種UI組件框架,如antd design,理解其設(shè)計(jì)理念、底層實(shí)現(xiàn)
2.掌握一種圖表繪制框架,如Echart,理解其設(shè)計(jì)理念、底層實(shí)現(xiàn),可以自己實(shí)現(xiàn)圖表
3.掌握一種GIS開發(fā)框架,如百度地圖API
4.掌握一種可視化開發(fā)框架,如Three.js、D3
5.工具函數(shù)庫(kù),如lodash、underscore、moment等,理解使用的工具類或工具函數(shù)的具體實(shí)現(xiàn)原理
開發(fā)和調(diào)試
1.熟練使用各瀏覽器提供的調(diào)試工具
2.熟練使用一種代理工具實(shí)現(xiàn)請(qǐng)求代理、抓包,如charls
3.可以使用Android、IOS模擬器進(jìn)行調(diào)試,并掌握一種真機(jī)調(diào)試方案
4.了解Vue、React等框架調(diào)試工具的使用
七、前端工程
前端工程化:以工程化方法和工具提高開發(fā)生產(chǎn)效率、降低維護(hù)難度
項(xiàng)目構(gòu)建
1.理解npm、yarn依賴包管理的原理,兩者的區(qū)別
2.可以使用npm運(yùn)行自定義腳本
3.理解Babel、ESLint、webpack等工具在項(xiàng)目中承擔(dān)的作用
4.ESLint規(guī)則檢測(cè)原理,常用的ESLint配置
5.Babel的核心原理,可以自己編寫一個(gè)Babel插件
6.可以配置一種前端代碼兼容方案,如Polyfill
7.Webpack的編譯原理、構(gòu)建流程、熱更新原理,chunk、bundle和module的區(qū)別和應(yīng)用
8.可熟練配置已有的loaders和plugins解決問(wèn)題,可以自己編寫loaders和plugins
nginx
1.正向代理與反向代理的特點(diǎn)和實(shí)例
2.可手動(dòng)搭建一個(gè)簡(jiǎn)單的nginx服務(wù)器、
3.熟練應(yīng)用常用的nginx內(nèi)置變量,掌握常用的匹配規(guī)則寫法
4.可以用nginx實(shí)現(xiàn)請(qǐng)求過(guò)濾、配置gzip、負(fù)載均衡等,并能解釋其內(nèi)部原理
開發(fā)提速
1.熟練掌握一種接口管理、接口mock工具的使用,如yapi
2.掌握一種高效的日志埋點(diǎn)方案,可快速使用日志查詢工具定位線上問(wèn)題
3.理解TDD與BDD模式,至少會(huì)使用一種前端單元測(cè)試框架
版本控制
1.理解Git的核心原理、工作流程、和SVN的區(qū)別
2.熟練使用常規(guī)的Git命令、git rebase、git stash等進(jìn)階命令
3.可以快速解決線上分支回滾、線上分支錯(cuò)誤合并等復(fù)雜問(wèn)題
持續(xù)集成
1.理解CI/CD技術(shù)的意義,至少熟練掌握一種CI/CD工具的使用,如Jenkins
2.可以獨(dú)自完成架構(gòu)設(shè)計(jì)、技術(shù)選型、環(huán)境搭建、全流程開發(fā)、部署上線等一套完整的開發(fā)流程(包括Web應(yīng)用、移動(dòng)客戶端應(yīng)用、PC客戶端應(yīng)用、小程序、H5等等)
八、項(xiàng)目和業(yè)務(wù)
后端技能
1.了解后端的開發(fā)方式,在應(yīng)用程序中的作用,至少會(huì)使用一種后端語(yǔ)言
2.掌握數(shù)據(jù)最終在數(shù)據(jù)庫(kù)中是如何落地存儲(chǔ)的,能看懂表結(jié)構(gòu)設(shè)計(jì)、表之間的關(guān)聯(lián),至少會(huì)使用一種數(shù)據(jù)庫(kù)
性能優(yōu)化
1.了解前端性能衡量指標(biāo)、性能監(jiān)控要點(diǎn),掌握一種前端性能監(jiān)控方案
2.了解常見的Web、App性能優(yōu)化方案
3.SEO排名規(guī)則、SEO優(yōu)化方案、前后端分離的SEO
4.SSR實(shí)現(xiàn)方案、優(yōu)缺點(diǎn)、及其性能優(yōu)化
5.Webpack的性能優(yōu)化方案
6.Canvas性能優(yōu)化方案
7.React、Vue等框架使用性能優(yōu)化方案
前端安全
1.XSS攻擊的原理、分類、具體案例,前端如何防御
2.CSRF攻擊的原理、具體案例,前端如何防御
3.HTTP劫持、頁(yè)面劫持的原理、防御措施
業(yè)務(wù)相關(guān)
1.能理解所開發(fā)項(xiàng)目的整體業(yè)務(wù)形態(tài)、業(yè)務(wù)目標(biāo)、業(yè)務(wù)架構(gòu),可以快速定位線上業(yè)務(wù)問(wèn)題
2.能理解所開發(fā)項(xiàng)目整體的技術(shù)架構(gòu)、能快讀的根據(jù)新需求進(jìn)行開發(fā)規(guī)劃、能快速根據(jù)業(yè)務(wù)報(bào)警、線上日志等定位并解決線上技術(shù)問(wèn)題
3.可以將自己的想法或新技術(shù)在業(yè)務(wù)中落地實(shí)踐,盡量在團(tuán)隊(duì)中擁有一定的不可替代性
九、學(xué)習(xí)提升
vczh大神在知乎問(wèn)題【如何能以后達(dá)到溫趙輪三位大神的水平?】下的回答:
這十幾年我一共做了三件事:
1、不以賺錢為目的選擇學(xué)習(xí)的內(nèi)容;
2、以自己是否能造出輪子來(lái)衡量學(xué)習(xí)的效果;
3、堅(jiān)持每天寫自己的代碼,前10年每天至少6個(gè)小時(shí),不包含學(xué)習(xí)和工作的時(shí)間。
上面幾點(diǎn)可能有點(diǎn)難,第一點(diǎn)我就做不到,但是做到下面績(jī)點(diǎn)還是比較容易的。
關(guān)于寫博客說(shuō)明下,能給別人講明白的知識(shí)會(huì)比自己學(xué)習(xí)掌握的要深刻許多
1.擁有自己的技術(shù)博客,或者在一些博客平臺(tái)上擁有自己的專欄
2.定期的將知識(shí)進(jìn)行總結(jié),不斷完善自己的知識(shí)體系
3.盡量將自己的知識(shí)轉(zhuǎn)換成真實(shí)的產(chǎn)出,不要僅僅停留在書面理解層面,更重要的是實(shí)際應(yīng)用
4.堅(jiān)持輸出自己的代碼,不要盲目的扎進(jìn)公司業(yè)
十、技術(shù)之外
這部分可能比上面九條加起來(lái)重要!
1.了解互聯(lián)網(wǎng)人員術(shù)語(yǔ):CEO、CTO、COO、CFO、PM、QA、UI、FE、DEV、DBA、OPS等
2.了解互聯(lián)網(wǎng)行業(yè)術(shù)語(yǔ):B2B、B2C、C2C、O2O等
3.掌握互聯(lián)網(wǎng)行業(yè)溝通、問(wèn)答、學(xué)習(xí)的
4.有一定的"PPT"能力
5.有一定的理財(cái)意識(shí),至少了解儲(chǔ)蓄、貨幣基金、保險(xiǎn)、指數(shù)基金、股票等基本的理財(cái)知識(shí)
6.掌握在繁重的工作和長(zhǎng)期的電腦輻射的情況下保持健康的方法,建立正確的養(yǎng)生知識(shí)體系
其實(shí)在這個(gè)信息發(fā)達(dá)的時(shí)代最不缺的就是資源,如何從眾多的資源中獲取到真正精華的部分,是非常重要的,資源在于精不在于多,強(qiáng)烈建議在保證深度的情況下再保證廣度。
小結(jié)
希望你閱讀本篇文章后可以達(dá)到以下幾點(diǎn):
從知識(shí)清單中找到自己的知識(shí)盲點(diǎn)與欠缺
具有知識(shí)體系化的思想,開始建立自己的知識(shí)體系
閱讀文章時(shí)將知識(shí)歸類到知識(shí)體系中,并不斷完善自己的知識(shí)體系
從文章中獲取到了有用的資源
文中如有錯(cuò)誤,歡迎在評(píng)論區(qū)指正,如果這篇文章幫助到了你,歡迎點(diǎn)贊和關(guān)注。
如果你有什么好的知識(shí)、資源推薦,歡迎在評(píng)論區(qū)留言。
*請(qǐng)認(rèn)真填寫需求信息,我們會(huì)在24小時(shí)內(nèi)與您取得聯(lián)系。