css如何實(shí)現(xiàn)凸字形狀?這個(gè)問題可能是我們?nèi)粘W(xué)習(xí)或工作經(jīng)常見到的。希望通過這個(gè)問題能讓你收獲頗深。下面是小編給大家?guī)淼膮⒖純?nèi)容,讓我們一起來看看吧!
武進(jìn)網(wǎng)站建設(shè)公司創(chuàng)新互聯(lián),武進(jìn)網(wǎng)站設(shè)計(jì)制作,有大型網(wǎng)站制作公司豐富經(jīng)驗(yàn)。已為武進(jìn)數(shù)千家提供企業(yè)網(wǎng)站建設(shè)服務(wù)。企業(yè)網(wǎng)站搭建\成都外貿(mào)網(wǎng)站建設(shè)公司要多少錢,請(qǐng)找那個(gè)售后服務(wù)好的武進(jìn)做網(wǎng)站的公司定做!
最終效果如下所示
代碼在這兒:
<div class="box"> <span class="big"></span> <span class="top"></span> <span class="topR"></span> </div>
body { display: flex; justify-content: center; align-items: center; .box { position: relative; width: 400px; height: 400px; top: 200px; color: lightblue; .big { position: absolute; width: 400px; height: 200px; border-radius: 20px; background-color: currentColor; bottom: 0; } .top { position: absolute; width: 100px; left: calc((400px - 100px)/2); height: 150px; border-radius: 20px 20px 0 0; background-color: currentColor; top: 50px; } .top::before { content: ""; position: absolute; background-color: lightblue; height: 48px; width: 100px; left: -100px; top: 102px; } .top::before { content: ""; position: absolute; background-color: lightblue; height: 48px; width: 100px; left: -100px; top: 102px; } .top::after { content: ""; position: absolute; background-color: #fff; border-radius: 0 0 20px 0; height: 48px; width: 100px; left: -100px; top: 102px; } .topR { position: absolute; background-color: lightblue; height: 48px; width: 100px; right: 50px; top: 152px; } .topR::after { content: ""; position: absolute; background-color: #fff; border-radius: 0 0 0 20px; height: 48px; width: 100px; left: 0; top: 0; } } }
一開始我以為只要上下兩個(gè)圓角矩形拼接就行,NO NO NO,其實(shí)兩個(gè)圓角相交處還有圓角,一看這個(gè)圓角就知道,可以使用白色的圓角矩形覆蓋,那么問題來了:
白色的圓角矩形覆蓋之后,中間會(huì)形成空隙,這個(gè)空隙需要藍(lán)色填滿。所以思路是這樣的:
一、先建立上下兩個(gè)圓角矩形:
HTML:
<span class="big"></span> <span class="top"></span>
二:在上面的圓角矩形左右各加一個(gè)藍(lán)色色的圓角矩形,與上下兩個(gè)矩形相切,但是長度和寬度都不能超過上下兩個(gè)大矩形
三:再在后來添加的小藍(lán)色矩形塊兒上,各增加一個(gè)大小一致的白色矩形覆蓋,分別設(shè)置右下圓角與左下圓角,代碼如下:
border-radius: 0 0 20px 0; border-radius: 0 0 0 20px;
OK,大功告成!一個(gè)凸型框就制作好啦。
感謝各位的閱讀!看完上述內(nèi)容,你們對(duì)css如何實(shí)現(xiàn)凸字形狀大概了解了嗎?希望文章內(nèi)容對(duì)大家有所幫助。如果想了解更多相關(guān)文章內(nèi)容,歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道。
文章名稱:css如何實(shí)現(xiàn)凸字形狀
網(wǎng)頁URL:http://www.rwnh.cn/article14/pgchge.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供品牌網(wǎng)站設(shè)計(jì)、定制網(wǎng)站、網(wǎng)站改版、網(wǎng)站維護(hù)、商城網(wǎng)站、網(wǎng)站策劃
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)