css3 - 關(guān)于一個(gè)不可描述的css問(wèn)題,如圖
問(wèn)題描述
前端小白,實(shí)在不知道怎么描述這個(gè)效果,只知道后面那條線可以用gradient去實(shí)現(xiàn)看看,求大神指點(diǎn)!謝謝!
問(wèn)題解答
回答1:不用樓上這么復(fù)雜
HTML:
<p>電影</p>
CSS:
p{ font-size: 30px;}p::before,p::after{ content: ''; margin: 0 10px; height: 20px; display: inline-block; vertical-align: -0.2ex; border-left: 1px solid red;}p::after{ width: 150px; background: linear-gradient(to right,red,transparent) bottom/100% 1px no-repeat;}
這里主要是 background 的屬性的問(wèn)題,這里用到的格式如下:
background: background-image background-position/background-size background-repeat;回答2:
文字前后的修飾 分別使用偽元素實(shí)現(xiàn)通過(guò)設(shè)置偽元素的border屬性
回答3:
<style type='text/css'>*{ margin: 0; padding: 0; border: 0; }p{ display: inline-block; width: 75px; height: 50px; font-size: 30px; line-height: 50px; color: #000; }p:before{content:’|’;font-size:15px;color:red;}#span1{ display: inline-block; width: 1px; height: 15px; background: red; }#span2{ display: inline-block; width: 150px; height: 1px; border-left: 1px solid red; background: -moz-linear-gradient(left, red, #fff); background: -webkit-linear-gradient(left, red, #fff); background: -o-linear-gradient(left, red, #fff); }</style>
<p>電影</p><span id='span1'></span><span id='span2'></span>
gradient不能給border的顏色漸變,所以就分兩個(gè)span來(lái)寫(xiě),基本實(shí)現(xiàn)了,具體樣式值,就自己改吧。還有g(shù)radient的兼容性,inline-block間像素的去除方法,再仔細(xì)的百度吧。
相關(guān)文章:
1. css - 新裝的typecho博客程序?yàn)樯恫荒苌蟼鞲郊热鐖D片!2. javascript - 如何用js或者css3實(shí)現(xiàn)元素邊框的動(dòng)態(tài)效果,如圖?3. 怎么php怎么通過(guò)數(shù)組顯示sql查詢(xún)結(jié)果呢,查詢(xún)結(jié)果有多條,如圖。4. css3 - 如圖的flex骰子布局是怎么實(shí)現(xiàn)的?5. javascript - 如圖,百度首頁(yè),查看源代碼為什么什么都沒(méi)有?6. java - 如圖代碼,Collection 類(lèi)中的iterator()是抽象方法,為什么可以調(diào)用?7. 關(guān)于mysql unique的問(wèn)題,如圖所示8. java - 如圖,a.txt文件開(kāi)頭什么都沒(méi)有,F(xiàn)ileInputstream讀取的時(shí)候?yàn)槭裁催€會(huì)出現(xiàn)亂碼?9. MySQL主鍵沖突時(shí)的更新操作和替換操作在功能上有什么差別(如圖)10. 怎么php怎么通過(guò)數(shù)組顯示sql查詢(xún)結(jié)果呢,查詢(xún)結(jié)果有多條,如圖。我要forsearch里面echo

網(wǎng)公網(wǎng)安備