简体   繁体   English

在 web 页面上为溢出的文本行添加垂直空间

[英]Adding vertical space to overflowing line of text on the web page

I have a line of text containing a text field and a dropdown list.我有一行文本,其中包含一个文本字段和一个下拉列表。 On narrow screens the line overflows and the list glues to the text field.在狭窄的屏幕上,行溢出并且列表粘附到文本字段。 Is it possible to control the vertical spacing in the overflown line without affecting the spacing in the original non-overflown line?是否可以控制溢出行中的垂直间距而不影响原始非溢出行中的间距? If I just add extra vertical space it would produce bigger spacing in both overflown and non-overflown views.如果我只是添加额外的垂直空间,它会在溢出和非溢出视图中产生更大的间距。

在此处输入图像描述

It's hard to see without an example, but you could try using a media query to add a style.没有示例很难看出,但您可以尝试使用媒体查询来添加样式。 You would change the breakpoint to equal the point where your form wraps.您可以将断点更改为等于表单换行的点。 I used 600px for now, but yours might be different.我现在使用600px ,但你的可能会有所不同。 For example, if your text field had a class .my-text-input :例如,如果您的文本字段有一个 class .my-text-input


@media only screen and (max-width: 600px) {
  .my-text-input {
    margin-bottom: 10px;
  }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM