css偽類 右下角點(diǎn)擊出現(xiàn) 對(duì)號(hào)角標(biāo)表示選中的示例代碼
效果:

css:
.s_type {
border: none;
border-radius: 5px;
background-color: #f3f3f3;
padding: 7px 0;
color: #606266;
margin: 5px 2.5% 5px 0;
width: 30%;
position: relative;
}
.selecd {
background-color: #ebf3ff;
color: #5999fc;
}
.select {
background-color: #ebf3ff;
color: #5999fc;
}
.select:before {
content: '';
position: absolute;
right: 0;
bottom: 0;
border: 9px solid #5999fc;
border-top-color: transparent;
border-left-color: transparent;
}
html:
<button class="s_type">全部</button> <button class="s_type">2020年夏季</button>
js:
$(’.s_type’).on(‘click’,function(){
$(this).toggleClass(‘select’);
});
1:設(shè)計(jì)好按鈕本身的樣式(.s_type)
2:將要加的樣式另寫一個(gè)類名(.selecd )
3:通過(guò)點(diǎn)擊事件將元素添加樣式
剛開(kāi)始想過(guò)挺多方法的,比如直接在偽類里content: ‘✔’;但這樣的話出的效果就是對(duì)號(hào)沒(méi)有背景顏色,直接白了一塊,這樣不行。還想到要不直接把UI的圖摳出來(lái),當(dāng)背景或者圖片直接浮在按鈕上面,后面想想這樣不太對(duì)。然后我就先去做別的功能,把其他功能寫出來(lái)再弄這個(gè)。就剛好看到一篇文章跟我需要的功能一樣,就直接按照這篇博客寫了。。。然后效果出來(lái)了哈哈哈哈
后面去看UI庫(kù)之類的發(fā)現(xiàn)QQ的UI庫(kù)還有專門角標(biāo)設(shè)計(jì)(地址)
附錄:下面看下css 選中框樣式
在項(xiàng)目中經(jīng)常會(huì)用到下圖樣式的選中樣式

在網(wǎng)上找了一下,思路其實(shí)就是對(duì)矩形進(jìn)行變形處理,通過(guò)偽元素實(shí)現(xiàn)下標(biāo) css樣式:
.select {
position: relative;
width:81px;
height:93px;
margin: 0 auto;
text-align: center;
line-height: 93px;
color: #4ABE84;
background-color: #fff;
box-shadow:0px 2px 7px 0px rgba(85,110,97,0.35);
border-radius:7px;
border:1px solid rgba(74,190,132,1);
}
.select:before {
content: '';
position: absolute;
right: 0;
bottom: 0;
border: 17px solid #4ABE84;
border-top-color: transparent;
border-left-color: transparent;
}
.select:after {
content: '';
width: 5px;
height: 12px;
position: absolute;
right: 6px;
bottom: 6px;
border: 2px solid #fff;
border-top-color: transparent;
border-left-color: transparent;
transform: rotate(45deg);
}
然后是我們通過(guò)使用div來(lái)展示效果:
<div class="select">測(cè)試</div>
完成。
到此這篇關(guān)于css偽類 右下角點(diǎn)擊出現(xiàn) 對(duì)號(hào)角標(biāo)表示選中的示例代碼的文章就介紹到這了,更多相關(guān)css右下角對(duì)號(hào)角標(biāo)內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持腳本之家!
相關(guān)文章
CSS實(shí)現(xiàn)帶倒三角標(biāo)記的WEB標(biāo)準(zhǔn)菜單效果代碼
這篇文章主要為大家介紹了CSS實(shí)現(xiàn)帶倒三角標(biāo)記的WEB標(biāo)準(zhǔn)菜單效果代碼,通過(guò)純css實(shí)現(xiàn)鼠標(biāo)滑過(guò)呈現(xiàn)倒三角標(biāo)記的顯示效果,非常簡(jiǎn)單實(shí)用,需要的朋友可以參考下2015-10-12CSS教程:可擴(kuò)展圓角標(biāo)簽的實(shí)現(xiàn)方法-CSS教程-網(wǎng)頁(yè)制作-網(wǎng)頁(yè)教學(xué)網(wǎng)
在制作網(wǎng)頁(yè)的時(shí)候,很流行使用標(biāo)簽的方式進(jìn)行分類顯示,圓角標(biāo)簽具有樣式美觀、表現(xiàn)方式形象的優(yōu)點(diǎn),一般我們都會(huì)將圓角標(biāo)簽的背景制作成一張圖片,這樣做的不足之處是如2008-10-17
CSS 實(shí)現(xiàn)角標(biāo)效果的完整代碼
這篇文章主要介紹了CSS 實(shí)現(xiàn)角標(biāo)效果,分為圓角矩形和三角形,本文通過(guò)實(shí)例代碼給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2022-06-28


