使用CSS无线电自定义输入广播输入广播

问题描述 投票:0回答:2

早上好,我想把输入收音机放在这个圈子里,我找到了一个没有这个css的答案,但我需要用这个输入收音机定制css,就像这里一样。

我希望你能帮助我。

表中的相同内容:为什么我不能把它们放进去?

谢谢!安德鲁

这里是广播的CSS:

input[type="radio"] {
  -moz-appearance: none;
  -webkit-appearance: none;
  -ms-appearance: none;
  appearance: none;
  display: block;
  float: left;
  margin-right: -2rem;
  opacity: 0;
  width: 1rem;
  z-index: -1; }
  input[type="radio"] + label {
    text-decoration: none;
    cursor: pointer;
    display: inline-block;
    font-size: 1rem;
    font-weight: 400;
    padding-left: 2.825rem;
    padding-right: 0.875rem;
    position: relative; }
    input[type="radio"] + label:before {
      -moz-osx-font-smoothing: grayscale;
      -webkit-font-smoothing: antialiased;
      font-family: FontAwesome;
      font-style: normal;
      font-weight: normal;
      text-transform: none !important; }
    input[type="radio"] + label:before {
      border-radius: 4px;
      border: solid 1px;
      content: '';
      display: inline-block;
      height: 1rem;
      left: 0;
      line-height: 1.86875rem;
      position: absolute;
      text-align: center;
      top: +0.25rem;
      /*top: -0.1625rem;*/
      width: 1rem; }
  input[type="checkbox"]:checked + label:before,
  /*input[type="radio"]:checked + label:before*/ {
    content: '\f00c'; }

input[type="radio"] + label:before {
  border-radius: 100%; }

::-webkit-input-placeholder {
  opacity: 1.0; }

:-moz-placeholder {
  opacity: 1.0; }

::-moz-placeholder {
  opacity: 1.0; }

:-ms-input-placeholder {
  opacity: 1.0; }

label {
  color: #555555; }

input[type="text"],
input[type="password"],
input[type="email"],
input[type="tel"],
input[type="search"],
input[type="url"],
select,
textarea {
  background-color: rgba(0, 0, 0, 0.075);
  border-color: rgba(0, 0, 0, 0.25); }
  input[type="text"]:focus,
  input[type="password"]:focus,
  input[type="email"]:focus,
  input[type="tel"]:focus,
  input[type="search"]:focus,
  input[type="url"]:focus,
  select:focus,
  textarea:focus {
    border-color: #ce1b28;
    box-shadow: 0 0 0 1px #ce1b28; }

select {
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='40' height='40' preserveAspectRatio='none' viewBox='0 0 40 40'%3E%3Cpath d='M9.4,12.3l10.4,10.4l10.4-10.4c0.2-0.2,0.5-0.4,0.9-0.4c0.3,0,0.6,0.1,0.9,0.4l3.3,3.3c0.2,0.2,0.4,0.5,0.4,0.9 c0,0.4-0.1,0.6-0.4,0.9L20.7,31.9c-0.2,0.2-0.5,0.4-0.9,0.4c-0.3,0-0.6-0.1-0.9-0.4L4.3,17.3c-0.2-0.2-0.4-0.5-0.4-0.9 c0-0.4,0.1-0.6,0.4-0.9l3.3-3.3c0.2-0.2,0.5-0.4,0.9-0.4S9.1,12.1,9.4,12.3z' fill='rgba(0, 0, 0, 0.25)' /%3E%3C/svg%3E"); }
  select option {
    color: #444444;
    background-color: #ffffff; }

input[type="checkbox"] + label,
input[type="radio"] + label {
  color: #444444; }
  input[type="checkbox"] + label:before,
  input[type="radio"] + label:before {
    background: rgba(0, 0, 0, 0.075);
    border-color: rgba(0, 0, 0, 0.25); }
input[type="radio"]:checked + label:before {
  background-color: #ce1b28;
  border-color: #ce1b28;
  color: #ffffff; }
input[type="radio"]:focus + label:before {
  border-color: #ce1b28;
  box-shadow: 0 0 0 1px #ce1b28; }

::-webkit-input-placeholder {
  color: #bbbbbb !important; }

:-moz-placeholder {
  color: #bbbbbb !important; }

::-moz-placeholder {
  color: #bbbbbb !important; }

:-ms-input-placeholder {
  color: #bbbbbb !important; }
Here old solution working with radio button without css:

<div style="display:inline-block;position:relative">
	    <label style="position:absolute;top:55px;left:0;right:0;margin:auto;width:100%;display:inline-block" align="center"><input type="radio"/></label>
		<svg height="334.4" width="334.4">
		    <circle cx="167.2" cy="167.2" r="134" stroke="#00ffff" stroke-width=4 fill="#e6ffff" />
		    <text text-anchor="middle" stroke="#000000" stroke-width="1px" dy=".3em">
			    <tspan x="50%" y="25%" dy="1.2em">Line 1</tspan>
			</text>
		    <text text-anchor="middle" stroke="#000000" stroke-width="0.5px" dy=".3em">
				<tspan x="50%" y="35%" dy="1.2em">Line 2</tspan>
				<tspan x="50%" y="45%" dy="1.2em">Line 3</tspan>
				<tspan x="50%" y="55%" dy="1.2em">Line 4</tspan>
				<tspan x="50%" y="65%" dy="1.2em">Line 5</tspan>
				<tspan x="50%" y="75%" dy="1.2em">Line 6</tspan>
			</text>
		</svg>
	</div>

the example of unhidden radio. I would put only red.

html css input circle
2个回答
0
投票

从你的appearance: none删除input[type="radio"]s并将opacity: 0更改为opacity: 1

看小提琴,显示收音机:https://jsfiddle.net/e5bm16nd/1/


0
投票

input[type="radio"] {
  -moz-appearance: none;
  -webkit-appearance: none;
  -ms-appearance: none;
  appearance: none;

我保持外观删除红色按钮。

© www.soinside.com 2019 - 2024. All rights reserved.