自定義常用input表單元素二:純css實現自定義radio單選按鈕

這是接著上一篇純css自定義復選框checkbox的第二篇,自定義一個radio單選按鈕,同樣,采用css偽類和“+”css選擇器為思路,下面是預覽圖:

?

下面直入主題放代碼:HTML部分

<!--兩個name相同的radio-->
<input type="radio" id="my_radio1" class="my_radio" name="my_radio"><label for="my_radio1">單選Radio1</label>
<br />
<input type="radio" id="my_radio2" class="my_radio" name="my_radio">
<label for="my_radio2">單選Radio2</label>

HTML代碼沒什么說的,就是普通的label和input,定義相同的name即可。

下面為CSS部分:

/*radio單選主要樣式*/
.my_radio{opacity: 0;}
.my_radio+label::before {content: "";display: block;width: 16px;height: 16px;border-radius: 100%;border: 1px solid #d9d9d9;position: absolute;top: 3px;left: -24px;box-sizing: border-box;
}.my_radio:hover+label::before {-webkit-transition: all .3s;transition: all .3s;border-color: #1890ff
}.my_radio:checked+label::after {content: "";display: block;width: 8px;height: 8px;border-radius: 100%;background-color: #1890ff;position: absolute;top: 7px;left: -20px;border-color: #1890ff;-webkit-transition: all .3s;transition: all .3s;
}

四行css,第二行為radio最外層的圓圈,第四行為radio最里面選中時的實心圓。第三行為radio hover時的效果。其他樣式自己可根據需要修改。

?

轉載于:https://www.cnblogs.com/websharehome/p/9622090.html

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/279411.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/279411.shtml
英文地址,請注明出處:http://en.pswp.cn/news/279411.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

Elasticsearch之kopf插件安裝之后的瀏覽詳解

比如&#xff0c;我的這里是http://192.168.80.200:9200/_plugin/kopf/ 1、cluster 2、nodes 3、rest 4、more 5、更多詳情&#xff0c;隨著深入&#xff0c;再貼寫分享&#xff01; 本文轉自大數據躺過的坑博客園博客&#xff0c;原文鏈接&#xff1a;http://www.cnblogs.com/…

郵件系統之webmail

courier-authlib 網址http://www.courier-mta.org/ flush privileges 命令本質上的作用是將當前user和privilige表中的用戶信息/權限設置從mysql庫(MySQL數據庫的內置庫)中提取到內存里 虛擬用戶&#xff1a;Maildir &#xff1a;/var/mailbox/Suexec apache ,httpdusergroupht…

如何將Microsoft Word文檔轉換為PDF

PDFs are handy for distributing documents so that they’re seen the same way by all parties. Typically, you’ll create documents using another app, and then convert them to PDF. Here’s how to do it for a Microsoft Word document. PDF易于分發文檔&#xff0c…

ASP.NET WebApi 基于JWT實現Token簽名認證

一、前言 開發提供數據的WebApi服務&#xff0c;最重要的是數據的安全性。那么對于我們來說&#xff0c;如何確保數據的安全將會是需要思考的問題。在ASP.NET WebService服務中可以通過SoapHead驗證機制來實現&#xff0c;那么在ASP.NET WebApi中我們應該如何保證我們的接口安全…

Cage驗證碼生成器快速上手

Cage小巧&#xff0c;好用。這里在官方基礎例子基礎上做了擴展&#xff1a; 12345678910111213141516171819202122232425262728293031323334package com.lavasoft.ntv.web.common; import com.github.cage.IGenerator; import java.util.Random; /*** 驗證碼生成器 * * author …

馬云:未來無工可打,人工智能發展紅利還在10年以后

馬云雖然已經退出阿里巴巴&#xff0c;但作為一代商業傳奇他所說的話&#xff0c;還十分據有影響力。關于人工智能&#xff0c;馬云提出過不少預測性言論。未來10年&#xff0c;房子、車子都不在值錢。面對人工智能時代&#xff0c;未來傳統行業大部分會消失。更有厲害的&#…

如何更改您的iPhone鈴聲

The problem with having a popular phone like an iPhone is that, by default, everyone has the same ringtone. If you want to give your iPhone a more personal sound, here’s how to do it. 擁有像iPhone這樣的流行手機的問題是&#xff0c;默認情況下&#xff0c;每個…

【ACM-ICPC 2018 沈陽賽區網絡預賽 I】Lattice's basics in digital electronics

【鏈接】 我是鏈接,點我呀:) 【題意】 【題解】 每個單詞的前綴都不同。 不能更明示了... 裸的字典樹。 模擬一下。輸出一下就ojbk了。 【代碼】 #include <bits/stdc.h> #define LL long long #define rep1(i,a,b) for (int i a;i < b;i) #define rep2(i,a,b) for…

扒一扒那些年我們遇到的奇葩代碼

前言 本文首發于公眾號【一名打字員】 在工作中&#xff0c;我們通常會遇到傳說中的“祖傳”代碼&#xff0c;有些是否讓我們感到哭笑不得&#xff0c;今天本猿整理一下自己以及網絡上出現過的奇葩代碼。來源于互聯網的均會標明出處。 TOP1 當仁不讓的當然是傳說中的“睡排序”…

相對濕度與絕對濕度_如何監視家里的濕度水平

相對濕度與絕對濕度High humidity is no fun, and neither is low humidity—you want a good balance between the two. Here’s how to monitor the humidity in your house so that you can make the proper adjustments. 高濕度無濟于事&#xff0c;低濕度也無濟于事-您希望…

基于redis實現的扣減庫存

2019獨角獸企業重金招聘Python工程師標準>>> 在日常開發中有很多地方都有類似扣減庫存的操作&#xff0c;比如電商系統中的商品庫存&#xff0c;抽獎系統中的獎品庫存等。 解決方案 使用mysql數據庫&#xff0c;使用一個字段來存儲庫存&#xff0c;每次扣減庫存去更…

JavaScript 使用random()生成隨機數

function myFunction() { var a Math.floor(Math.random()*10);return a;} // 記住 Math.random() 永遠不會返回 1。同時因為我們是在用 Math.floor() 向下取整&#xff0c;所以最終我們獲得的結果不可能有 20。這確保了我們獲得了一個在0到19之間的整數。 把操作連綴起來&…

plex 亂碼_Plex Media Center現在支持播客

plex 亂碼Plex is adding beta support for podcasts to iOS, Android, Roku, and Plex Web today, alongside a custom home screen for mobile users. Plex現在為iOS&#xff0c;Android&#xff0c;Roku和Plex Web的播客添加了beta支持&#xff0c;同時為移動用戶提供了自定…

Add a All Document Folder

本文出自Simmy的個人blog&#xff1a;西米在線 http://simmyonline.com/archives/54.html right clickSearch Folder-New Search Folder-Custom-Create a custom folder 本文轉simmy51CTO博客&#xff0c;原文鏈接&#xff1a;http://blog.51cto.com/helpdesk/122327&#xff0…

Oracle服務器修改IP后

機房有兩套網絡&#xff0c;一套辦公網&#xff0c;一套機房的內網&#xff0c;辦公網可以通過vpn在其他地方訪問&#xff0c;內網只能在公司辦公室訪問。團隊有同事去外地辦公&#xff0c;開發的時候需要通過客戶端直連數據庫&#xff0c;于是把數據庫服務器的網線換到辦公網的…

代理IP對直播平臺的影響與關系-國內多IP曇花一現

1.代理IP的作用1>.訪問一些單位或團體內部資源&#xff0c;如某大學FTP(前提是該代理地址在該資源 的允許訪問范圍之內)&#xff0c;使用網絡內地址段免費代理服務器&#xff0c;就可以用于對 網絡開放的各類FTP下載上傳&#xff0c;以及各類資料查詢共享等服務。國內站群整…

ios12徹底關閉siri_Siri正在iOS 12中獲取自定義語音操作

ios12徹底關閉siriSiri is about to get a lot more powerful. Custom voice commands for any app will allow you to say “Hey Siri, I lost my keys” to instantly launch an app that will help you find them. Siri將變得更加強大。 針對任何應用程序的自定義語音命令將…

spring cloud連載第一篇之bootstrap context

1. Spring Cloud Context: Application Context Services&#xff08;應用上下文服務&#xff09; 1.1 The Bootstrap Application Context&#xff08;引導上下文&#xff09; 一個spring cloud應用會創建一個“bootstrap”context&#xff0c;它是主應用的parent context。它…

過Postfix構建Exchange Server 2010郵件網關部署系列三:安裝Exchange 2010先決性條件

1.將Exchange Server 2010服務器加入域。 2.在“開始”菜單上&#xff0c;依次導航到“所有程序”>“附件”>“Windows PowerShell”。打開提升的 Windows PowerShell 控制臺并運行以下命令&#xff1a; Import-Module ServerManager 3.使用 Add-WindowsFeature cmdlet 安…

gmail收件箱標簽設置_通過多個收件箱實驗室有效管理您的Gmail

gmail收件箱標簽設置Most people have more than one email account and if you are using Gmail it’s easy to get things set up so that all of your messages can be accessed in the same place. But if you would prefer to keep things ‘together yet separate’ the …