繁体   English   中英

CSS text-align属性无法正常工作

[英]CSS text-align property is not working properly

我对此脚本有问题。

输出未与中心对齐; 只有红色可以正常工作。

<script>      
    $(document).ready(function () {
        $("#register_form input").focus(function () {
            $("#status").fadeOut(800);
        });

        $("#pass1").keyup(function () {
            if ($(this).val().length < 6) {
                $("#output_pass1").css("color", "red").css('text-align', 'center').html("<br/><br/>very short ");

            }
        });
    });
</script>

这是HTML代码:

<label for="pass1">Password :</label>
<div class="col-sm-5">
    <input type="Password" id="pass1" placeholder="Enter your password " required>
</div>

<small id="output_pass1" ></small>

请给元素display: block; ,也:

small { display: block; }

要么

$("#output_pass1")
.css({"color":"red", "text-align":"center", "display": "block" })
.html("<br/><br/>very short ");

小提琴: http : //jsfiddle.net/aslancods/NDNYF/5/

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM