html - 对齐窗体右侧的控件

标签 html css asp.net-mvc-5

我正在使用 asp.net mvc 和 kendo 构建数据输入表单。我想在右侧有一些控件。目前,如果您看到它们在左侧对齐。我也想要右边的一些

enter image description here

我该怎么做。这是下面的代码

<div id="addEdit" style="width 100%; height 100%; background-color #fff;">
    <div class="demo-section k-content">
        <ul class="fieldlist">
            <li>
                <label for="simple-input">Employee Number</label>
                <input id="simple-input" type="text" class="k-textbox" style="width: 40%;" />
            </li>
            <li>
                <label for="simple-input">ForeName</label>
                <input id="simple-input" type="text" class="k-textbox" style="width: 40%;" />
            </li>
            <li>
                <label for="simple-input">ForeName</label>
                <input id="simple-input" type="text" class="k-textbox" style="width: 40%;" />
            </li>
            <li>
                <label for="simple-input">Surname</label>
                <input id="simple-input" type="text" class="k-textbox" style="width: 40%;" />
            </li>
            <li>
                <label for="simple-input">Preferred Name</label>
                <input id="simple-input" type="text" class="k-textbox" style="width: 40%;" />
            </li>
            <li>
                <label for="simple-input">Language</label>
                <input id="language"  style="width: 40%;" />
            </li>
            <li>
                <label for="simple-input">Country</label>
                <input id="country" style="width: 40%;" />
            </li>
            <li>
                <label for="simple-input">Preferred Name</label>
                <input id="simple-input" type="text" class="k-textbox" style="width: 40%;" />
            </li>



            <li>

                <button class="k-button">Cancel</button>&nbsp;
                <button class="k-button k-primary">Save</button>
            </li>

        </ul>
        <style>
            .fieldlist {
                margin: 0 0 -2em;
                padding: 0;
            }

                .fieldlist li {
                    list-style: none;
                    padding-bottom: 2em;
                }

                .fieldlist label {
                    display: block;
                    padding-bottom: 1em;
                    font-weight: bold;
                    text-transform: uppercase;
                    font-size: 10px;
                    color: #444;
                }
        </style>
    </div>

最佳答案

您可以拆分包含表单的 div,并将“float:left”和“float:right”添加到新的。

<div style="float:left; width:40%">
    //what u want here
</div>
<div style="float:right; width:40%">
    //what u want here
</div>

编辑:

<div id="addEdit" style="width 100%; height 100%; background-color #fff;">
<div class="demo-section k-content">
    <div style="float:left; width:40%">
        <ul class="fieldlist">
            <li>
                <label for="simple-input">Employee Number</label>
                <input id="simple-input" type="text" class="k-textbox" style="width: 40%;" />
            </li>
             // the content you want here    
        </ul>
    </div>
    <div style="float:right; width:40%">  
         <ul class="fieldlist">      
            <li>
                <label for="simple-input">Country</label>
                <input id="country" style="width: 40%;" />
            </li>
             // the content you want here   
        </ul>
    </div> 
</div>        

关于html - 对齐窗体右侧的控件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42655507/

相关文章:

html - 如何将此按钮与文本框对齐?

html - 如何在选择列表中添加图像?

c# - MVC 与 [Authorize] 相反,也许类似于 [DenyAuthorized]..?

asp.net-mvc - 返回excel文件而不将其保存在 Controller 内的服务器中

html - 垂直居中一个div

html - Internet Explorer 7 菜单换行

javascript - 将表单状态保存到服务器而不干扰页面

javascript - 将 css 内容属性的字体大小缩放到父级

java - Jsoup 仅选择带有其他元素的 div 中的文本

c# - 在没有自定义路由的情况下调用 Api