柚子快報(bào)邀請(qǐng)碼778899分享:前端 css Document
柚子快報(bào)邀請(qǐng)碼778899分享:前端 css Document
hello
復(fù)制代碼
參考鏈接
github.com/cttin/cttin…
請(qǐng)你講一講 CSS 的權(quán)重和優(yōu)先級(jí)
權(quán)重
從0開始,一個(gè)行內(nèi)樣式+1000,一個(gè)id選擇器+100,一個(gè)屬性選擇器、class或者偽類+10,一個(gè)元素選擇器,或者偽元素+1,通配符+0
優(yōu)先級(jí)
權(quán)重相同,寫在后面的覆蓋前面的使用 !important 達(dá)到最大優(yōu)先級(jí),都使用 !important 時(shí),權(quán)重大的優(yōu)先級(jí)高
參考鏈接
zhuanlan.zhihu.com/p/41604775
問:介紹 Flex 布局,flex 是什么屬性的縮寫:
彈性盒布局,CSS3 的新屬性,用于方便布局,比如垂直居中flex屬性是?flex-grow、flex-shrink?和?flex-basis?的簡寫
參考鏈接
www.ruanyifeng.com/blog/2015/0…
問:CSS 怎么畫一個(gè)大小為父元素寬度一半的正方形?
Document
.inner { width: 50%; padding-bottom: 50%; background: blue; }
復(fù)制代碼
CSS實(shí)現(xiàn)自適應(yīng)正方形、等寬高比矩形
雙重嵌套,外層 relative,內(nèi)層 absolutepadding 撐高如果只是要相對(duì)于 body 而言的話,還可以使用 vw 和 vh偽元素設(shè)置 margin-top: 100%撐高
雙重嵌套,外層 relative,內(nèi)層 absolute
Document
.inner { position: absolute; width: 100%; height: 100%; top: 0; left: 0; background: blue; }
hello
復(fù)制代碼
padding 撐高畫正方形
Document
.inner { width: 100%; height: 0; padding-bottom: 100%; background: red; }
復(fù)制代碼
相對(duì)于視口 VW VH
Document
復(fù)制代碼
偽元素設(shè)置 margin-top
Document
.inner::after { content: “”; margin-top: 100%; display: block; }
復(fù)制代碼
參考鏈接
www.fly63.com/article/det…
(2)問:實(shí)現(xiàn)兩欄布局的方式:
左 float,然后右 margin-left(右邊自適應(yīng))
Document
.aside { width: 300px; float: left; background: yellow; }
.main { background: aqua; margin-left: 300px; }
復(fù)制代碼
右 float,margin-right
Document
.aside { width: 300px; float: right; background: yellow; }
.main { background: aqua; margin-right: 300px; }
復(fù)制代碼
BFC + float
Document
.aside { width: 300px; float: left; background: yellow; }
.main { overflow: hidden; background: aqua; }
復(fù)制代碼
float + 負(fù) margin
.right { float: left; width: 200px; background: #0f0; }
hello
world
復(fù)制代碼
圣杯布局實(shí)現(xiàn)兩欄布局
Document
/* .box { overflow: hidden; } */
/* .container { padding: 0 300px 0 200px; border: 1px solid black; } */
html, body { height: 100%; }
div { height: 100%; }
.container { display: flex; }
.content { flex: 1 1; order: 2; background: #f00; }
.left { float: left; width: 100%; background: #0f0; }
.right { float: left; width: 300px; margin-left: -300px; background: #00f; }
你好
我好
復(fù)制代碼
flex 實(shí)現(xiàn)兩欄布局
Document
/* .box { overflow: hidden; } */
/* .container { padding: 0 300px 0 200px; border: 1px solid black; } */
html, body { height: 100%; }
div { height: 100%; }
.container { display: flex; }
.content { flex: 1 1; order: 2; background: #f00; }
.left { flex: 0 0 200px; background: #0f0; }
.right { flex: 1 1; background: #00f; }
你好
我好
復(fù)制代碼
參考鏈接:juejin.im/post/5e8d52…
position + margin
Document
/* .box { overflow: hidden; } */
/* .container { padding: 0 300px 0 200px; border: 1px solid black; } */
html, body { height: 100%; }
div { height: 100%; }
.container { display: flex; position: relative; }
.content { flex: 1 1; order: 2; background: #f00; }
.left { position: absolute; width: 300px; background: #0f0; }
.right { width: 100%; margin-left: 300px; background: #00f; }
你好
我好
復(fù)制代碼
實(shí)現(xiàn)三列布局的方式
position + margin-left + margin-right
Document
.box { position: relative; }
.left { position: absolute; left: 0; top: 0; width: 200px; background: green; }
.right { position: absolute; right: 0; top: 0; width: 200px; background: red; }
.middle { margin-left: 200px; margin-right: 200px; background: black; }
復(fù)制代碼
通過 float + margin
Document
.left { float: left; width: 200px; height: 200px; background: green; }
.right { float: right; width: 200px; height: 200px; background: red; }
.middle { margin-left: 210px; margin-right: 210px; background: black; height: 200px; }
復(fù)制代碼
圣杯布局
Document
.content { float: left; width: 100%; background: #f00; }
.left { width: 200px; background: #0f0; float: left; margin-left: -100%; position: relative; left: -200px; }
.right { width: 300px; background: #00f; float: left; margin-left: -300px; position: relative; right: -300px; }
中間內(nèi)容
左側(cè)區(qū)域
右側(cè)區(qū)域
復(fù)制代碼
雙飛翼布局
Document
div { height: 100%; }
.main { float: left; width: 100%; background: #f00; }
.main .content { margin-left: 200px; margin-right: 300px; }
.left { width: 200px; background: #0f0; float: left; margin-left: -100%; }
.right { width: 300px;
自我介紹一下,小編13年上海交大畢業(yè),曾經(jīng)在小公司待過,也去過華為、OPPO等大廠,18年進(jìn)入阿里一直到現(xiàn)在。
深知大多數(shù)前端工程師,想要提升技能,往往是自己摸索成長或者是報(bào)班學(xué)習(xí),但對(duì)于培訓(xùn)機(jī)構(gòu)動(dòng)則幾千的學(xué)費(fèi),著實(shí)壓力不小。自己不成體系的自學(xué)效果低效又漫長,而且極易碰到天花板技術(shù)停滯不前!
因此收集整理了一份《2024年Web前端開發(fā)全套學(xué)習(xí)資料》,初衷也很簡單,就是希望能夠幫助到想自學(xué)提升又不知道該從何學(xué)起的朋友,同時(shí)減輕大家的負(fù)擔(dān)。
既有適合小白學(xué)習(xí)的零基礎(chǔ)資料,也有適合3年以上經(jīng)驗(yàn)的小伙伴深入學(xué)習(xí)提升的進(jìn)階課程,基本涵蓋了95%以上前端開發(fā)知識(shí)點(diǎn),真正體系化!
由于文件比較大,這里只是將部分目錄大綱截圖出來,每個(gè)節(jié)點(diǎn)里面都包含大廠面經(jīng)、學(xué)習(xí)筆記、源碼講義、實(shí)戰(zhàn)項(xiàng)目、講解視頻,并且后續(xù)會(huì)持續(xù)更新
如果你覺得這些內(nèi)容對(duì)你有幫助,可以添加V獲?。簐ip1024c (備注前端)
最后
總的來說,面試官要是考察思路就會(huì)從你實(shí)際做過的項(xiàng)目入手,考察你實(shí)際編碼能力,就會(huì)讓你在電腦敲代碼,看你用什么編輯器、插件、編碼習(xí)慣等。所以我們在回答面試官問題時(shí),有一個(gè)清晰的邏輯思路,清楚知道自己在和面試官說項(xiàng)目說技術(shù)時(shí)的話就好了
一個(gè)人可以走的很快,但一群人才能走的更遠(yuǎn)。不論你是正從事IT行業(yè)的老鳥或是對(duì)IT行業(yè)感興趣的新人,都?xì)g迎掃碼加入我們的的圈子(技術(shù)交流、學(xué)習(xí)資源、職場吐槽、大廠內(nèi)推、面試輔導(dǎo)),讓我們一起學(xué)習(xí)成長!
鏈圖片轉(zhuǎn)存中…(img-BYvknn2N-1712948825219)] [外鏈圖片轉(zhuǎn)存中…(img-mqFzZLKV-1712948825219)] [外鏈圖片轉(zhuǎn)存中…(img-txWkbJOz-1712948825219)] [外鏈圖片轉(zhuǎn)存中…(img-KXo41z78-1712948825220)]
既有適合小白學(xué)習(xí)的零基礎(chǔ)資料,也有適合3年以上經(jīng)驗(yàn)的小伙伴深入學(xué)習(xí)提升的進(jìn)階課程,基本涵蓋了95%以上前端開發(fā)知識(shí)點(diǎn),真正體系化!
由于文件比較大,這里只是將部分目錄大綱截圖出來,每個(gè)節(jié)點(diǎn)里面都包含大廠面經(jīng)、學(xué)習(xí)筆記、源碼講義、實(shí)戰(zhàn)項(xiàng)目、講解視頻,并且后續(xù)會(huì)持續(xù)更新
如果你覺得這些內(nèi)容對(duì)你有幫助,可以添加V獲取:vip1024c (備注前端) [外鏈圖片轉(zhuǎn)存中…(img-OE96Ltxk-1712948825220)]
最后
總的來說,面試官要是考察思路就會(huì)從你實(shí)際做過的項(xiàng)目入手,考察你實(shí)際編碼能力,就會(huì)讓你在電腦敲代碼,看你用什么編輯器、插件、編碼習(xí)慣等。所以我們在回答面試官問題時(shí),有一個(gè)清晰的邏輯思路,清楚知道自己在和面試官說項(xiàng)目說技術(shù)時(shí)的話就好了
[外鏈圖片轉(zhuǎn)存中…(img-vCFTTcVC-1712948825220)]
[外鏈圖片轉(zhuǎn)存中…(img-1RQtYtAa-1712948825221)]
一個(gè)人可以走的很快,但一群人才能走的更遠(yuǎn)。不論你是正從事IT行業(yè)的老鳥或是對(duì)IT行業(yè)感興趣的新人,都?xì)g迎掃碼加入我們的的圈子(技術(shù)交流、學(xué)習(xí)資源、職場吐槽、大廠內(nèi)推、面試輔導(dǎo)),讓我們一起學(xué)習(xí)成長! [外鏈圖片轉(zhuǎn)存中…(img-JkTf2LU6-1712948825221)]
柚子快報(bào)邀請(qǐng)碼778899分享:前端 css Document
推薦閱讀
本文內(nèi)容根據(jù)網(wǎng)絡(luò)資料整理,出于傳遞更多信息之目的,不代表金鑰匙跨境贊同其觀點(diǎn)和立場。
轉(zhuǎn)載請(qǐng)注明,如有侵權(quán),聯(lián)系刪除。