单选按钮不会以html格式显示

时间:2017-07-11 07:11:01

标签: javascript html css radio-button

我是html和css的新手。我打算用html和css创建一个注册表单。但是,当我在浏览器中运行html文件时,不会显示单选按钮。我不知道哪个部分出了问题。请帮忙! 这是我的html文件,

<!DOCTYPE html>
<html>
<style>
    input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
</style>
<head>
    <meta charset="utf-8" />
    <meta name="format-detection" content="telephone=no" />
    <meta name="msapplication-tap-highlight" content="no" />
    <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />
    <link rel="stylesheet" type="text/css" href="css/ionic.min.css" />
    <title>Create an Account</title>
</head>
<body>
    <div class="bar bar-header">
        <h1 class="title">Create an Account</h1>
        <a href="login.html" class="button button-clear button-royal">Login</a>
    </div>
    <div class="padding" style="margin-top:75px;">
        <label class="item-input">
            <span class="input-label">Full Name</span>
            <input type="text" placeholder="" id="fullname">
        </label>
        <label class="item-input">
            <span class="input-label">Username</span>
            <input type="text" placeholder="" id="username">
        </label>
        <label class="item-input">
            <span class="input-label">Email</span>
            <input type="email" placeholder="" id="email">
        </label>
        <label class="item-input">
            <span class="input-label">Password</span>
            <input type="password" placeholder="" id="password">
        </label>
        <label class="item-input">
            <span class="input-label">Contact</span>
            <input type="number" placeholder="" id="contact">
        </label>
        <label class="item-input">
            <span class="input-label">Gender</span>
            <p>
                <input name="gender" type="radio" id="male" value="male" />
                <label for="male">Male</label>
                <input name="gender" type="radio" id="female" value="female" />
                <label for="female">Female</label>
            </p>
        </label>
        <label class="item-input">
            <button class="button button-block button-positive" id="signup">Create an Account</button>
        </label>


    </div>
    <script type="text/javascript" src="cordova.js"></script>
    <script type="text/javascript" src="js/jq.js"></script>
    <script type="text/javascript" src="js/auth.js"></script>
</body>

</html> 

css文件是ionic.min.css。这是css文件中的单选按钮部分。

.item-input input {
    -webkit-border-radius: 0;
    border-radius: 0;
    -webkit-box-flex: 1;
    -webkit-flex: 1 220px;
    -moz-box-flex: 1;
    -moz-flex: 1 220px;
    -ms-flex: 1 220px;
    flex: 1 220px;
    -webkit-appearance: normal;
    -moz-appearance: none;
    appearance: none;
    margin: 0;
    padding-right: 24px;
    background-color: transparent
}
.item-radio .item-content {
    position: relative;
    z-index: 2;
    padding: 16px 49px 16px 16px;
    border: none;
    background-color: #fff
}

input[type=radio],
input[type=checkbox] {
    margin: 0;
    line-height: normal
}

.item-input input[type=radio],

input[type=radio][disabled],
input[type=radio][readonly],
input[type=checkbox][disabled],
input[type=checkbox][readonly] {
    background-color: transparent
}

.item-radio {
    padding: 0
}

.item-radio:hover {
    cursor: pointer
}

.item-radio .item-content {
    padding-right: 64px
}

.item-radio .radio-icon {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 3;
    visibility: hidden;
    padding: 14px;
    height: 100%;
    font-size: 24px
}

.item-radio input {
    position: absolute;
    left: -9999px
}

.item-radio input:checked~.item-content {
    background: #f7f7f7
}

.item-radio input:checked~.radio-icon {
    visibility: visible
}

.platform-android.grade-b .item-radio,
.platform-android.grade-c .item-radio {
    -webkit-animation: androidCheckedbugfix infinite 1s
}

2 个答案:

答案 0 :(得分:1)

如果单选按钮可见而不是在您的情况下加载css文件问题,请尝试将CS​​S内联放入样式标记内

答案 1 :(得分:0)

更改-webkit-appearance:none;在css文件中-webkit-appearance:normal;用于项目输入输入。