RError.com

RError.com Logo RError.com Logo

RError.com Navigation

  • 主页

Mobile menu

Close
  • 主页
  • 系统&网络
    • 热门问题
    • 最新问题
    • 标签
  • Ubuntu
    • 热门问题
    • 最新问题
    • 标签
  • 帮助
主页 / 问题 / 954722
Accepted
Андрей
Андрей
Asked:2020-03-10 23:11:32 +0000 UTC2020-03-10 23:11:32 +0000 UTC 2020-03-10 23:11:32 +0000 UTC

一行中的元素排列[关闭]

  • 772
关闭 这个问题是题外话。目前不接受回复。

寻求调试帮助的问题(“为什么这段代码不起作用? ”)应该包括期望的行为、具体的问题或错误,以及在问题中重现它的最少代码。没有明确描述问题的问题对其他访问者毫无用处。请参阅如何创建一个最小的、独立的和可重现的示例。

3年前关闭。

改进问题

有一个页面,您需要在该页面上将多个元素排列成一行。我做到了,但出于某种原因,在两种不同的情况下,我采取了不同的做法,我不明白为什么。

选项1:

    <div class="row">
                <div class="col-sm-4">
                    <div class="form-group">
                        @Html.Label("С", new { @style = "margin-right: 5px" })
                        <input type="date" />
                    </div>
                </div>
                <div class="col-sm-6">
                    <div class="form-group">
                        @Html.Label("По", new { @style = "margin-right: 5px" })
                        <input type="date" />
                    </div>
                </div>
            </div>

4 个元素排成一排。但是有一个例子不适合相同的方法。选项 2:

    <div class="row">
                <div class="col-sm-10">
                    <div class="row">
                        <div class="col-sm-4">
                            <div class="form-group" style="margin-right: 10px">
                                @Html.RadioButton("Proceeds", "Seller", true)
                                @Html.Label("По продавцу")
                            </div>
                        </div>
                        <div class="col-sm-8">
                            <div class="form-group">
                                @Html.DropDownList("sellerList", Enumerable.Empty<SelectListItem>(), new { @style = "display: inline-block", @class = "form-control" })
                                @Html.CheckBox("allSeller")
                                @Html.Label("По каждому")
                            </div>
                        </div>
                    </div>

                    <div class="row">
                        <div class="col-sm-4">
                            <div class="form-group" style="margin-right: 10px">
                                @Html.RadioButton("Proceeds", "Auto", false)
                                @Html.Label("По автомобилю")
                            </div>
                        </div>
                        <div class="col-sm-8">
                            <div class="form-group">
                                @Html.DropDownList("autoList", Enumerable.Empty<SelectListItem>(), new { @style = "display: inline-block", @class = "form-control" })
                                @Html.CheckBox("allAuto")
                                @Html.Label("По каждой")
                            </div>
                        </div>
                    </div>
                </div>
                <div class="col-sm-2">
                    <div class="row">
                        <div class="col-sm-12">
                            <input type="button" value="Выручка" class="btn btn-primary btn-block" style="height: 80px" />
                        </div>
                    </div>
                </div>
            </div>

在这种情况下,必须设置下拉列表,"display: inline-block"否则下一个标签将转移到下一行。这是为什么?如果我做错了什么,你能告诉我吗?

这是来自浏览器的代码:

<div class="row">
    <div class="col-sm-8">
        <div id="headTableProceeds">
            <table class="table table-bordered" style="margin: 0; table-layout: fixed">
                <thead>
                    <tr>
                        <th id="sel" style="display: none">Продавец</th>
                        <th id="auto" style="display: none">Автомобиль</th>
                        <th id="proceeds" style="display: none">Выручка</th>
                    </tr>
                </thead>
            </table>
        </div>
        <div id="bodyTableProceeds" class="container">
            <table class="table table-bordered">
                <tbody></tbody>
            </table>
        </div>

        <div class="row">
            <div class="col-sm-12">
                <label for="">Фильтры детализации:</label>
            </div>
        </div>

        <div class="row">
            <div class="col-sm-12">
                <input id="Date" name="Date" type="checkbox" value="true" /><input name="Date" type="hidden" value="false" />
                <label for="">По дате</label>
            </div>
        </div>

        <div class="row">
            <div class="col-sm-4">
                <div class="form-group">
                    <label for="" style="margin-right: 5px">С</label>
                    <input type="date" disabled />
                </div>
            </div>
            <div class="col-sm-6">
                <div class="form-group">
                    <label for="" style="margin-right: 5px">По</label>
                    <input type="date" disabled />
                </div>
            </div>
        </div>

        <div class="row">
            <div class="col-sm-10">
                <div class="row">
                    <div class="col-sm-4">
                        <div class="form-group" style="margin-right: 10px">
                            <input checked="checked" id="Proceeds" name="Proceeds" type="radio" value="Seller" />
                            <label for="">По продавцу</label>
                        </div>
                    </div>
                    <div class="col-sm-8">
                        <div class="form-group">
                            <select class="form-control" id="sellerList" name="sellerList" style="display: inline-block"></select>
                            <input id="allSeller" name="allSeller" type="checkbox" value="true" /><input name="allSeller" type="hidden" value="false" />
                            <label for="">По каждому</label>
                        </div>
                    </div>
                </div>

                <div class="row">
                    <div class="col-sm-4">
                        <div class="form-group" style="margin-right: 10px">
                            <input id="Proceeds" name="Proceeds" type="radio" value="Auto" />
                            <label for="">По автомобилю</label>
                        </div>
                    </div>
                    <div class="col-sm-8">
                        <div class="form-group">
                            <select class="form-control" disabled="disabled" id="autoList" name="autoList" style="display: inline-block"></select>
                            <input disabled="disabled" id="allAuto" name="allAuto" type="checkbox" value="true" /><input name="allAuto" type="hidden" value="false" />
                            <label for="">По каждой</label>
                        </div>
                    </div>
                </div>
            </div>
            <div class="col-sm-2">
                <div class="row">
                    <div class="col-sm-12">
                        <input type="button" value="Выручка" class="btn btn-primary btn-block" style="height: 80px" />
                    </div>
                </div>
            </div>
        </div>

        <table style="display: none" id="equipTable" class="table table-bordered">
            <thead>
                <tr>
                    <th>Двигатель</th>
                    <th>Мощность</th>
                    <th>Год выпуска</th>
                    <th>Тип привода</th>
                    <th>КПП</th>
                    <th>Кузов</th>
                    <th>Максимальная скорость</th>
                    <th>Вес</th>
                    <th>Бак</th>
                    <th>Цвет</th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td></td>
                </tr>
            </tbody>
        </table>
    </div>
    <div style="display: none" class="col-sm-4">
        <img id="autoPic" class="img-responsive" src="/Content/auto.jpg" />
    </div>
</div>

在此处输入图像描述

html
  • 1 1 个回答
  • 10 Views

1 个回答

  • Voted
  1. Best Answer
    Виталий Шебаниц
    2020-03-11T02:51:06Z2020-03-11T02:51:06Z

    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
    <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
    <div class="row">
      <div class="col-sm-8">
          <div id="headTableProceeds">
              <table class="table table-bordered" style="margin: 0; table-layout: fixed">
                  <thead>
                      <tr>
                          <th id="sel" style="display: none">Продавец</th>
                          <th id="auto" style="display: none">Автомобиль</th>
                          <th id="proceeds" style="display: none">Выручка</th>
                      </tr>
                  </thead>
              </table>
          </div>
          <div id="bodyTableProceeds" class="container">
              <table class="table table-bordered">
                  <tbody></tbody>
              </table>
          </div>
    
          <div class="row">
              <div class="col-sm-12">
                  <label for="">Фильтры детализации:</label>
              </div>
          </div>
    
          <div class="row">
              <div class="col-sm-12">
                  <input id="Date" name="Date" type="checkbox" value="true" /><input name="Date" type="hidden" value="false" />
                  <label for="">По дате</label>
              </div>
          </div>
    
          <div class="row">
              <div class="col-sm-4">
                  <div class="form-group">
                      <label for="" style="margin-right: 5px">С</label>
                      <input type="date" disabled />
                  </div>
              </div>
              <div class="col-sm-6">
                  <div class="form-group">
                      <label for="" style="margin-right: 5px">По</label>
                      <input type="date" disabled />
                  </div>
              </div>
          </div>
    
          <div class="row">
              <div class="col-sm-10">
                  <div class="row">
                      <div class="col-sm-4">
                          <div class="form-group" style="margin-right: 10px">
                              <input checked="checked" id="Proceeds" name="Proceeds" type="radio" value="Seller" />
                              <label for="">По продавцу</label>
                          </div>
                      </div>
                      <div class="col-sm-8">
                          <div class="row">
                              <div class="col-sm-8">
                                    <select class="form-control" id="sellerList" name="sellerList"></select>
                              </div>
                              <div class="col-sm-4">
                                    <input id="allSeller" name="allSeller" type="checkbox" value="true" />
                                    <input name="allSeller" type="hidden" value="false" />
                                    <label for="allSeller">По каждому</label>
                              </div>
                          </div>
                      </div>
                  </div>
    
                  <div class="row">
                      <div class="col-sm-4">
                          <div class="form-group" style="margin-right: 10px">
                              <input id="Proceeds" name="Proceeds" type="radio" value="Auto" />
                              <label for="">По автомобилю</label>
                          </div>
                      </div>
                      <div class="col-sm-8">
                          <div class="row">
                              <div class="col-sm-8">
                                    <select class="form-control" disabled="disabled" id="autoList" name="autoList"></select>
                              </div>
                              <div class="col-sm-4">
                                    <input disabled="disabled" id="allAuto" name="allAuto" type="checkbox" value="true" />
                                    <input name="allAuto" type="hidden" value="false" />
                                    <label for="allAuto">По каждой</label>
                              </div>
                          </div>
                      </div>
                  </div>
              </div>
              <div class="col-sm-2">
                  <div class="row">
                      <div class="col-sm-12">
                          <input type="button" value="Выручка" class="btn btn-primary btn-block" style="height: 80px" />
                      </div>
                  </div>
              </div>
          </div>
    
          <table style="display: none" id="equipTable" class="table table-bordered">
              <thead>
                  <tr>
                      <th>Двигатель</th>
                      <th>Мощность</th>
                      <th>Год выпуска</th>
                      <th>Тип привода</th>
                      <th>КПП</th>
                      <th>Кузов</th>
                      <th>Максимальная скорость</th>
                      <th>Вес</th>
                      <th>Бак</th>
                      <th>Цвет</th>
                  </tr>
              </thead>
              <tbody>
                  <tr>
                      <td></td>
                  </tr>
              </tbody>
          </table>
      </div>
      <div style="display: none" class="col-sm-4">
          <img id="autoPic" class="img-responsive" src="/Content/auto.jpg" />
      </div>
    </div>

    • 1

相关问题

Sidebar

Stats

  • 问题 10021
  • Answers 30001
  • 最佳答案 8000
  • 用户 6900
  • 常问
  • 回答
  • Marko Smith

    根据浏览器窗口的大小调整背景图案的大小

    • 2 个回答
  • Marko Smith

    理解for循环的执行逻辑

    • 1 个回答
  • Marko Smith

    复制动态数组时出错(C++)

    • 1 个回答
  • Marko Smith

    Or and If,elif,else 构造[重复]

    • 1 个回答
  • Marko Smith

    如何构建支持 x64 的 APK

    • 1 个回答
  • Marko Smith

    如何使按钮的输入宽度?

    • 2 个回答
  • Marko Smith

    如何显示对象变量的名称?

    • 3 个回答
  • Marko Smith

    如何循环一个函数?

    • 1 个回答
  • Marko Smith

    LOWORD 宏有什么作用?

    • 2 个回答
  • Marko Smith

    从字符串的开头删除直到并包括一个字符

    • 2 个回答
  • Martin Hope
    Alexandr_TT 2020年新年大赛! 2020-12-20 18:20:21 +0000 UTC
  • Martin Hope
    Alexandr_TT 圣诞树动画 2020-12-23 00:38:08 +0000 UTC
  • Martin Hope
    Air 究竟是什么标识了网站访问者? 2020-11-03 15:49:20 +0000 UTC
  • Martin Hope
    Qwertiy 号码显示 9223372036854775807 2020-07-11 18:16:49 +0000 UTC
  • Martin Hope
    user216109 如何为黑客设下陷阱,或充分击退攻击? 2020-05-10 02:22:52 +0000 UTC
  • Martin Hope
    Qwertiy 并变成3个无穷大 2020-11-06 07:15:57 +0000 UTC
  • Martin Hope
    koks_rs 什么是样板代码? 2020-10-27 15:43:19 +0000 UTC
  • Martin Hope
    Sirop4ik 向 git 提交发布的正确方法是什么? 2020-10-05 00:02:00 +0000 UTC
  • Martin Hope
    faoxis 为什么在这么多示例中函数都称为 foo? 2020-08-15 04:42:49 +0000 UTC
  • Martin Hope
    Pavel Mayorov 如何从事件或回调函数中返回值?或者至少等他们完成。 2020-08-11 16:49:28 +0000 UTC

热门标签

javascript python java php c# c++ html android jquery mysql

Explore

  • 主页
  • 问题
    • 热门问题
    • 最新问题
  • 标签
  • 帮助

Footer

RError.com

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

帮助

© 2023 RError.com All Rights Reserve   沪ICP备12040472号-5