首页 \ 问答 \ 将Bootstrap行和列与其对应的字段对齐(Align Bootstrap rows and columns with its corresponding fields)

将Bootstrap行和列与其对应的字段对齐(Align Bootstrap rows and columns with its corresponding fields)

我正在尝试使用bootstrap的响应列和行。 我创建了标签和字段,以便我可以了解它是如何工作的。 我正在尝试将文本字段与其对应的标签对齐。 我正在使用bootstraps文档来说明如何做到这一点,但无法弄清楚诀窍。

为什么我的字段会移到底部,如何将文本字段与相应的标签对齐。

参考: https //getbootstrap.com/docs/4.0/layout/grid/

<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" type="text/css">
<script src="https://code.jquery.com/jquery-1.9.1.js" type="text/javascript"></script>

<div class="container">
  <div class="col-sm-12">
    <div class="row">
      <div class="col-sm-4">
        One
      </div>
      <div class="col-sm-4">
        two
      </div>
      <div class="col-sm-4">
        three
      </div>
    </div>
    <div class="row">
      <div class="col-sm-4">
        <input id="Text1" type="text" placeholder="one" />
      </div>
      <div class="col-sm-4">
        <input id="Text2" type="text" placeholder="two" />
      </div>
      <div class="col-sm-4">
        <input id="Text3" type="text" placeholder="three" />
      </div>
    </div>
  </div>
</div>

在此处输入图像描述


I'm trying to work with bootstrap's responsive column and rows. I created labels and fields so that I can learn how it works. I'm trying to align the text-fields with its corresponding labels. I was using bootstraps documentation on how to do it, but couldn't figure out the trick.

Why are my fields moving to the bottom and how can I align the text-fields to the corresponding labels.

Ref: https://getbootstrap.com/docs/4.0/layout/grid/

<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" type="text/css">
<script src="https://code.jquery.com/jquery-1.9.1.js" type="text/javascript"></script>

<div class="container">
  <div class="col-sm-12">
    <div class="row">
      <div class="col-sm-4">
        One
      </div>
      <div class="col-sm-4">
        two
      </div>
      <div class="col-sm-4">
        three
      </div>
    </div>
    <div class="row">
      <div class="col-sm-4">
        <input id="Text1" type="text" placeholder="one" />
      </div>
      <div class="col-sm-4">
        <input id="Text2" type="text" placeholder="two" />
      </div>
      <div class="col-sm-4">
        <input id="Text3" type="text" placeholder="three" />
      </div>
    </div>
  </div>
</div>

enter image description here


原文:https://stackoverflow.com/questions/48939427
更新时间:2022-08-07 17:08

最满意答案

Java-8中的G1区域大小基于startingHeapSize/2048并且DOWN舍入到1MB到32MB之间的第一个2的幂; 区域大小<1MB或> 32MB不受支持。

您还可以通过-XX:G1HeapRegionSize=n设置区域大小(注意,该值具有相同的2次幂/范围限制)。

实际上,JVM似乎偏向2048到4095之间的区域数(假设堆在2GB到128GB之间)。

通常,这些是每个堆大小范围的区域大小:

 <4GB -  1MB
 <8GB -  2MB
<16GB -  4MB
<32GB -  8MB
<64GB - 16MB
64GB+ - 32MB

注意,MB实际上是MiB,GB实际上是GiB


G1 region-size in Java-8 is based on startingHeapSize/2048 and rounded DOWN to the first power of 2 between 1MB and 32MB; region sizes <1MB or >32MB are not supported.

you can also set the region-size via -XX:G1HeapRegionSize=n (note, the value has the same power-of-2/range restrictions).

so actually the JVM seems biased towards a region count between 2048 and 4095 (assuming a heap between 2GB and 128GB).

in general these are the region-sizes per heap-size range:

 <4GB -  1MB
 <8GB -  2MB
<16GB -  4MB
<32GB -  8MB
<64GB - 16MB
64GB+ - 32MB

note, MB is actually MiB and GB is actually GiB

相关问答

更多
  • 收集器将堆分成固定大小的区域并跟踪这些区域中的实时数据。 它保留了一组指针 - “记住的集合” - 进出该区域。 当GC被认为是必要的时,它首先收集数据量较少的区域(因此,“垃圾优先”)。 通常,这可能意味着一步收集整个区域:如果指向区域的指针数量为零,则不需要对该区域进行标记或扫描。 对于每个地区,它都会跟踪描述收集这些信息需要多长时间的各种指标。 你可以给它一个关于暂停时间的软实时约束,然后它会尽量在那个约束时间内收集尽可能多的垃圾。 JavaOne谈论了G1,并就此话题撰写了几篇文章: http:// ...
  • 我一直在使用jEdit运行: -Xmx192M -XX:+UnlockExperimentalVMOptions -XX:+UseG1GC 在窗户上的最后几天。 没有经历过任何错误或行为不端。 我也尝试使用G1 GC来运行Intellij,但它并不公平。 它持续了几个小时,然后在一大堆混乱中崩溃,也许有点乐观。 I've been running jEdit using: -Xmx192M -XX:+UnlockExperimentalVMOptions -XX:+UseG1GC for the las ...
  • 听起来好像G1的要点是有更小的暂停时间,甚至可以指定最大暂停时间目标。 垃圾收集不仅仅是一个简单的“嘿,它是充分的,让我们一起移动所有的东西,重新开始”处理 - 这是复杂的,多层次的后台线程系统。 它可以在后台进行大量的维护,无需暂停,并且还在运行时使用系统预期模式的知识来帮助 - 像假设大多数对象在创建之后死亡等。 我会说,GC暂停时间将在未来版本中继续改善,而不会恶化。 编辑: 在重新阅读时,我发现我每天都在使用Java - Eclipse,Azureus和我开发的应用程序,而且从我看到一个暂停的时间已 ...
  • 并注意到启动应用程序需要更多时间 这有几个原因 第一:在大多数情况下,默认收集器是并行收集器,也称为吞吐量收集器。 就相对于在应用程序代码中花费的壁时间而言在GC中花费的壁时间而言,它是最有效的。 [1] 。 它不必承担执行并发工作的额外成本。 G1主要通过在部分并发集合上消耗额外的CPU周期来优化大堆上的较短暂停时间,这需要您有足够的CPU周期。 吞吐量只是次要目标。 第二:启用G1更改比使用的算法更多,许多默认设置也会更改。 diff <(java -XX:+UseG1GC -XX:+PrintFlag ...
  • 来自JEP 248 (JEP - JDK增强提案) 概要 使G1成为32位和64位服务器配置上的默认垃圾收集器。 动机 通常,限制GC暂停时间比最大化吞吐量更重要。 对于大多数用户来说,切换到像G1这样的低暂停收集器应该比面向吞吐量的收集器(如目前默认的并行GC)提供更好的整体体验。 在JDK 8及其更新版本中对G1进行了许多性能改进,并计划对JDK 9进行进一步改进。在JDK 8u40中引入并发类卸载(JEP 156)使G1成为一个功能齐全的垃圾收集器,准备好了默认。 总而言之,这是他们长期以来的工作,对 ...
  • 那个说你应该对它进行基准测试的人是对的 - GC是一个复杂的问题,很难给出100%的正确答案。 此外,它取决于所使用的实现。 在JRuby中,它是JVM做的工作。 在MRI中,它是一个标记和扫描GC。 在MRI的情况下,它或多或少都是这样的:每次Ruby解释器需要更多内存时,它会运行GC来尝试释放它。 如果内存不足,它会分配更多内存。 并且当没有对象的引用时,GC决定一个对象可以被释放(“标记”它)。 我能给你的唯一建议是避免使用大量不能被垃圾收集的对象。 例如,如果您正在构建一个字符串数组(它们的大小并不 ...
  • Java-8中的G1区域大小基于startingHeapSize/2048并且DOWN舍入到1MB到32MB之间的第一个2的幂; 区域大小<1MB或> 32MB不受支持。 您还可以通过-XX:G1HeapRegionSize=n设置区域大小(注意,该值具有相同的2次幂/范围限制)。 实际上,JVM似乎偏向2048到4095之间的区域数(假设堆在2GB到128GB之间)。 通常,这些是每个堆大小范围的区域大小: <4GB - 1MB <8GB - 2MB <16GB - 4MB <32GB - 8 ...
  • 这不是限制,只是建议。 一些替代GC没有经过JVMTI(JVM的分析界面)的良好测试。 G1 GC将成为标准GC,因此情况有所不同。 It's not a limitation, it's just advice. Some of the alternative GCs are not well tested with the JVMTI (the profiling interface of the JVM). G1 GC will become the standard GC, so there the ...
  • 我的观察。 停止自定义某些参数时,G1GC非常有效。 我建议删除Xmn (young gen)设置。 设置-Xms和-Xmx不同值 区域大小应配置为最大堆内存大小/ 2048.对于4G堆,2 MB应为区域大小和2 GB堆,1 MB应为理想区域大小。 要配置的关键参数: -XX:G1HeapRegionSize=n, XX:MaxGCPauseMillis=m, -XX:ParallelGCThreads=n, -XX:ConcGCThreads=n除了-Xms and -Xmx 有关详细信息,请查看此SE帖 ...
  • 你的意思是,除了使用较少的弱/软参考? 如果你想要表现,我会尽可能地避免它们。 您可以启用-XX:+TraceReferenceGC以获取有关引用的更多信息。 我经常建议人们尝试更大的Eden大小,并使用内存分析器来减少你产生的垃圾量。 如果有很多人从终身空间中解脱出来,你似乎会得到很多过早的晋升。 Do you mean, apart from using less weak/soft references? I would avoid them as much as you can if you wan ...

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。