级联样式表对齐 [英] Cascading style sheets alignment

查看:68
本文介绍了级联样式表对齐的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

打印四个单选按钮的代码,具有用于对齐的css。按钮Clic事件按钮向左移动应保持中心对齐



< html> 
< head>
< Style type = text / css>
.right_aligned label
{
float:left;
clear:left;
padding-right:1em;
text-align:right;
}
table.center
{
margin-left:auto;
margin-right:auto;
}
< / Style>
< script src ='https://code.jquery.com/jquery-1.12.4.min.js'>
< / script>
< script type ='text / javascript'>
$(document).ready(function()
{$('#btnGetValue')。click(function()
{
var selValue = $('input [name = rbnNumber]:checked')。val();
$('p')。html('< br /> You Selected:'+ selValue +'');});});
< / script>
< script> function buttonClickHandler(){}
< / script>
< / head>
< body>
< table class ='center'>
< TR>
< TD>计算机科学< / TD>
< / TR>
< TR>
< TD>
< input type ='radio'align =''name ='rbnNumber'value ='您选择了(a)并且这不是正确答案'/>(a)和< br />
< input type ='radio'align =''name ='rbnNumber'value ='您选择了(b)今天正确答案'/>(b)今天< br />
< input type ='radio'align =''name ='rbnNumber'value ='您选择了(c)cs,这不是正确答案'/>(c)cs< br />
< input type ='radio'align =''name ='rbnNumber'value ='您选择(d)os,这不是正确答案'/>(d)os< br />
< / TD>
< / TR>
< TD>
< p>,结果为< / p>
< / TD>
< TR>
< / TR>
< / table>
< table class ='center'>
< TR>
< TD>
< input type ='button'id ='btnGetValue'Value ='Get Value'>
< / TD>
< / TR>
< / table>
< / body>
< / html>





我尝试过:



css,java,javascript和code

解决方案

(document).ready(function()
{


('#btnGetValue')。click(function()
{
var selValue =


('input [name = rbnNumber]:检查')VAL();

Code that prints four radio buttons, has css for alignment. On Button Clic Event the buttons move towards left should stay center aligned

<html>
    <head>
        <Style type = text/css>
            .right_aligned label
            {
            float: left;
            clear: left;
            padding-right: 1em;
            text-align: right;
            }
            table.center 
            {
            margin-left:auto; 
            margin-right:auto;
            }
        </Style>
        <script src='https://code.jquery.com/jquery-1.12.4.min.js'>            
        </script>
        <script type='text/javascript'>
            $(document).ready(function()
            {$('#btnGetValue').click(function() 
            {
            var selValue = $('input[name=rbnNumber]:checked').val();
            $('p').html('<br/>You Selected : ' + selValue + '');});});
        </script>
        <script>function buttonClickHandler(){}
        </script>
    </head>
    <body>
    <table class = 'center'>
    <TR>
        <TD>Computer Science</TD>
    </TR>
    <TR>
    <TD>  
    <input type='radio' align ='' name='rbnNumber' value='You selected(a) andwhichis notthe correct answer'/>(a) and<br/>
    <input type='radio' align ='' name='rbnNumber' value='You selected(b) Todaywhichisthe correct answer'/>(b) Today<br/>
    <input type='radio' align ='' name='rbnNumber' value='You selected(c) cs whichis notthe correct answer'/>(c) cs<br/>
    <input type='radio' align ='' name='rbnNumber' value='You selected(d) os whichis notthe correct answer'/>(d) os<br/>
    </TD>
    </TR>
    <TD>    
    <p>and the results are </p>
    </TD>
    <TR>        
    </TR>
    </table>
    <table class = 'center'>
        <TR>
        <TD>
        <input type='button' id='btnGetValue' Value='Get Value'>       
        </TD>
        </TR>
    </table>        
    </body>
    </html>



What I have tried:

css, java, javascript and code

解决方案

(document).ready(function() {


('#btnGetValue').click(function() { var selValue =


('input[name=rbnNumber]:checked').val();


这篇关于级联样式表对齐的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆