我想使模式,看起来像一个聊天盒.我已经完成了大部分工作,但输入区域并不固定.理想情况下,我希望输入文本在页脚上,但模式页脚似乎有一个不可见的左边距或填充,我无法通过css摆脱它.我希望整个模式页脚字段都被占用.

我try 将其填充和边距设置为0,但无济于事.

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">

<div class="modal modal-dialog modal-dialog-centered modal-dialog-scrollable">
  <div class="modal-content">
    <div class="modal-header">
      <img src="https://via.placeholder.com/50" alt="picture of angie" class="chatbox-pic img-fluid" />
      <h1 class="modal-title fs-5 mx-3" id="chat-modalLabel">Angie</h1>
      <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
    </div>
    <div class="modal-body">
      <div class="chatbox">
        <p class="chat1">Hi! I really like your picture!</p>
        <div class="clear"></div>
        <p class="chat2">
          Thanks! I love yours, btw. You look busy with work.
        </p>
        <div class="clear"></div>
        <p class="chat1">
          I do. Thank goodness THWP is for busy people like us.
        </p>
        <div class="clear"></div>
        <p class="chat2">Loving this app. It's lovable with you in it.</p>
        <div class="clear"></div>
        <p class="chat1">LOL. Where you at right now? Work?</p>
        <div class="clear"></div>
        <p class="chat2">Yeah. I'm near Rosenberg. How about you?</p>
        <div class="clear"></div>
        <p class="chat1">That's just a 15-min drive from here!</p>
        <div class="clear"></div>
        <p class="chat2">Nice! You free today?</p>
        <div class="clear"></div>
        <p class="chat1">Sadly, no.</p>
        <div class="clear"></div>
        <p class="chat2">Bummer.</p>
        <div class="clear"></div>
        <p class="chat1">I'm free this Saturday. Maybe, we could...</p>
      </div>
    </div>
    <div class="modal-footer justify-content-between">
      <form>
        <label for="message-text"></label>
        <div class="input-group">
          <input type="text" class="form-control w-100" id="message-text" aria-describedby="send-button" />
          <div class="input-group-append">
            <a href="#" class="btn input-group-text"><span
                      class="material-symbols-rounded align-middle"
                      id="send-button"
                      >send</span
                    ></a
                  >
                </div>
              </div>
            </form>
          </div>
        </div>
      </div>

推荐答案

有两件事你必须知道:

  1. 模式页脚有填充,因此需要使用p-0或px-0将其设置为cero.
  2. 表格不是100%宽度,所以你需要设置w-100类.

因此,我对您的代码进行了以下更改:

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" integrity="sha384-T3c6CoIi6uLrA9TneNEoa7RxnatzjcDSCmG1MXxSR1GAsXEV/Dwwykc2MPK8M2HN" crossorigin="anonymous">

<div class="modal modal-dialog modal-dialog-centered modal-dialog-scrollable">
  <div class="modal-content">
    <div class="modal-header">
      <img src="https://via.placeholder.com/50" alt="picture of angie" class="chatbox-pic img-fluid" />
      <h1 class="modal-title fs-5 mx-3" id="chat-modalLabel">Angie</h1>
      <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
    </div>
    <div class="modal-body">
      <div class="chatbox">
        <p class="chat1">Hi! I really like your picture!</p>
        <div class="clear"></div>
        <p class="chat2">
          Thanks! I love yours, btw. You look busy with work.
        </p>
        <div class="clear"></div>
        <p class="chat1">
          I do. Thank goodness THWP is for busy people like us.
        </p>
        <div class="clear"></div>
        <p class="chat2">Loving this app. It's lovable with you in it.</p>
        <div class="clear"></div>
        <p class="chat1">LOL. Where you at right now? Work?</p>
        <div class="clear"></div>
        <p class="chat2">Yeah. I'm near Rosenberg. How about you?</p>
        <div class="clear"></div>
        <p class="chat1">That's just a 15-min drive from here!</p>
        <div class="clear"></div>
        <p class="chat2">Nice! You free today?</p>
        <div class="clear"></div>
        <p class="chat1">Sadly, no.</p>
        <div class="clear"></div>
        <p class="chat2">Bummer.</p>
        <div class="clear"></div>
        <p class="chat1">I'm free this Saturday. Maybe, we could...</p>
      </div>
    </div>
    <div class="modal-footer justify-content-between px-0">
      <form class="w-100">
        <label for="message-text"></label>
        <div class="input-group">
          <input type="text" class="form-control w-100" id="message-text" aria-describedby="send-button" />
          <div class="input-group-append">
            <a href="#" class="btn input-group-text"><span
                      class="material-symbols-rounded align-middle"
                      id="send-button"
                      >send</span
                    ></a
                  >
                </div>
              </div>
            </form>
          </div>
        </div>
      </div>

Html相关问答推荐

我需要两个HTML标签,以便当另一个隐藏时,一个可见,反之亦然

springBoot + Thymeleaf:属性中的UTF-8

弹性项在主轴方向溢出

如何删除html原生对话框的宽度

如何从ThymeLeaf模板中分离CSS

我无法使用背景图像css,因为我在VS代码中将照片放在不同的文件夹中

SCSS动画错误:心脏在页面刷新时启动动画,原因是:Checked和:Not(:Checked) Select 器

我无法动态嵌入Instagram帖子,因为无法分配Instagram固定链接

如何使VS代码支持以模仿嵌套的方式对已经包含注释的HTML进行注释?

如何将tmap按钮和图例更改为位于页脚后面?

在HTML使用link标签导入外部CSS时出现元素link不允许使用尾斜杠错误

BeautifulSoup用名称列表的findall无法找到另一个目标后面的目标

CSS 网格跨度行到所有行

如何制作一个布局,其中左侧固定为图像,右侧为按钮,中心或中间位置为文本?

如何动态调整彼此重叠的两个 div 的大小,使它们在增长时保持相同的高度

为四开本网站主页添加背景图片

如何在 blazor 中单击单个按钮调用 2 个等待任务

需要禁用聚焦输入的工具提示(jquery)

变换元素以适应高度(Angular,SCSS)

所有幻灯片上的 Quarto RevealJS 标题