简体   繁体   English

文本未在列内换行

[英]Text is not wrapping within column

I'm working on a small project to learn some basics of HTML & CSS and am currently trying to create the "advanced search" page on Google: https://www.google.com/advanced_search我正在做一个小项目来学习一些 HTML 和 CSS 的基础知识,目前正在尝试在 Google 上创建“高级搜索”页面: https : //www.google.com/advanced_search

I've got the structure of the page more or less how I would like it to be, but I'm having some difficult with the responsive functionality.我已经或多或少地获得了我想要的页面结构,但是我在响应功能方面遇到了一些困难。 Currently the text in the third column is not wrapping within the divs they are situated in. Here are some screenshots to demonstrate the issue:当前,第三列中的文本未包含在它们所在的 div 中。以下是一些屏幕截图来演示该问题:

Fullscreen (no issues):全屏(没有问题): 在此处输入图片说明

Reduced Width (not wrapping within column):减少宽度(不在列内换行): 在此处输入图片说明

Regarding the second image, the issue is highlighted by the red outline and I would like the text to wrap where the green outline is.关于第二张图片,问题由红色轮廓突出显示,我希望文本环绕绿色轮廓所在的位置。

Here is the existing HTML & CSS code:这是现有的 HTML 和 CSS 代码:

 @media only screen and (max-width: 960px) { .todoinstructions { display: none; } } #findpageswith { padding: 40px; } .todothisheader { font-weight: bold; font-size: 13px; } .todothismalltext { font-size: 11px; }
 <div class="container-fluid" id="findpageswith"> <div class="row"> <div class="col-sm-3 align-self-center">Find pages with...</div> <div class="col-5"></div> <div class="col-auto align-self-center todothisheader todoinstructions">To do this in the search box.</div> </div> <br> <div class="row"> <div class="col-sm-3 align-self-center">all these words:</div> <div class="col-5"> <input class="form-control" type="text" aria-label="Search"> </div> <div class="col-auto align-self-center todothismalltext todoinstructions">Type the important words: tri-colour rat terrier</div> </div> <br> <div class="row"> <div class="col-sm-3 align-self-center">this exact word or phrase:</div> <div class="col-5"> <input class="form-control" type="text" aria-label="Search"> </div> <div class="col-auto align-self-center todothismalltext todoinstructions">Put exact words in quotes: "rat terrier"</div> </div> <br> <div class="row"> <div class="col-sm-3 align-self-center">any of these words:</div> <div class="col-5"> <input class="form-control" type="text" aria-label="Search"> </div> <div class="col-auto align-self-center todothismalltext todoinstructions">Type OR between all the words you want: miniature OR standard</div> </div> <br> <div class="row"> <div class="col-sm-3 align-self-center">none of these words:</div> <div class="col-5"> <input class="form-control" type="text" aria-label="Search"> </div> <div class="col-auto align-self-center todothismalltext todoinstructions">Put a minus sign just before words that you don't want: -rodent, -"Jack Russell"</div> </div> </div>

I have had a read through the Bootstrap documentation on text wrapping and overflow ( https://getbootstrap.com/docs/4.4/utilities/text/#text-wrapping-and-overflow ), but can't seem to find a way to resolve this issue.我已经阅读了有关文本换行和溢出的 Bootstrap 文档( https://getbootstrap.com/docs/4.4/utilities/text/#text-wrapping-and-overflow ),但似乎找不到方法来解决这个问题。 I did try using "overflow-wrap:", but to no avail - it is possible that I was using it incorrectly.我确实尝试使用“溢出包装:”,但无济于事 - 可能是我使用不当。

If anybody has any ideas for how to resolve this, I would really appreciate the help.如果有人对如何解决此问题有任何想法,我将非常感谢您的帮助。

Thank you.谢谢你。

col-auto is not a true bs class I think you just need to set col . col-auto不是真正的 bs 类,我认为您只需要设置col

auto is only used for break points like: col-{breakpoint}-auto auto仅用于断点,例如: col-{breakpoint}-auto

BS doc: https://getbootstrap.com/docs/4.0/layout/grid/#setting-one-column-width https://getbootstrap.com/docs/4.0/layout/grid/#variable-width-content BS 文档: https : //getbootstrap.com/docs/4.0/layout/grid/#setting-one-column-width https://getbootstrap.com/docs/4.0/layout/grid/#variable-width-content

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

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