使用CSS使文本停留在HTML div的底部

时间:2018-06-27 07:15:33

标签: html css

快速简单的问题。我想要一个浮动框,该框位于div的右下角(使用HTML)。我将如何使用CSS做到这一点?  谢谢! (附件是我想要的样子)enter image description here

2 个答案:

答案 0 :(得分:1)

您要寻找的是: std::vector<uint8_t>,它将相对于已定位的父对象定位事物。请注意,父元素(div)也需要设置其位置。大多数人都position:absolute; bottom:0; right:0;position:relative;bottom:0的意思是将其从父级底部移开0px,从父级右侧移开0px。 有关更多信息,请参见以下w3schools:

  1. https://www.w3schools.com/css/css_positioning.asp
  2. https://www.w3schools.com/css/tryit.asp?filename=trycss_position_absolute

答案 1 :(得分:1)

希望这就是您想要的。

   .navBar {
      height: 100px;
      background-color: blue;
    }

    .div1 {
      position: relative;
      height: 200px;
    }

    .div1 .box {
        position: absolute;
        bottom: 40px;;
        right: 40px;;
        width: 200px;
        height: 40px;
        background-color: red;
    }

    .div2 {
      height: 100px;
      background: green;
    }

    <div class="main-container">
      <div class="navBar"></div>
      <div class="div1"><div class="box"></div></div>
      <div class="div2"></div>
    </div>