[英]HTML placing elements in the same row
I have the following form for uploading files (using some Bootstrap css) in Asp.NET MVC. 我具有以下格式用于在Asp.NET MVC中上传文件(使用一些Bootstrap CSS)。 Right now the "Clear" button is below the input field; 现在,“清除”按钮在输入字段下方 ; how to make it to the right of the input-field? 如何使其在输入字段的右侧?
I thought about using <table>
and have one column for the input fields and one for the buttons, but it doesn't seem suitable and Visual Studio gave me the squiggly lines when i tried. 我考虑过使用<table>
并在输入字段中有一列,在按钮中有一列,但这似乎不合适,Visual Studio在尝试时给了我弯曲的线条。
@using (Html.BeginForm("Index", "Uploader", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
<div class="form-group">
<input type="file" name="files" id="file1" />
<button onclick="reset2($('#file1'));event.preventDefault()">Clear</button>
<span class="field-validation-error" id="err1"></span>
@Html.ValidationMessage("1")
</div>
<div class="form-group">
<input type="file" name="files" id="file2" />
<button onclick="reset2($('#file2'));event.preventDefault()">Clear</button>
<span class="field-validation-error" id="err2"></span>
@Html.ValidationMessage("2")
</div>
... more file input fields
}
A simple style="display:inline"
on the input will work as follows; 输入上的简单style="display:inline"
如下所示;
<div class="form-group">
<input type="file" name="files" id="file1" style="display:inline" />
<button onclick="reset2($('#file1'));event.preventDefault()">Clear</button>
<span class="field-validation-error" id="err1"></span>
</div>
<div class="form-group">
<input type="file" name="files" id="file2" style="display:inline" />
<button onclick="reset2($('#file2'));event.preventDefault()">Clear</button>
<span class="field-validation-error" id="err2"></span>
</div>
I'm sure that some will have a better answer than mine that is more bootstrap specific however. 我敢肯定,有些人会比我的有更好的答案,但是我的答案更多地是自举。
Screen grab 屏幕抓取
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.