1、异常代码

  

<style>
.box{
min-height: 100vh;
width: 100%;
position: relative;
}
.position{
position: absolute;
left: 0;
width: 100%;
bottom: 0;
}
</style>
<body>
<div class="box">
   <input type="text"/>
<div class="position">
底部
</div>
</div>
</body>

  

  这样的代码,我们可以看到底部的position会随着 input 输入,高度变化而上来

  这样有可能底部会挡住元素

2、解决方法

<style>
.box{
min-height: 100vh;
width: 100%;
position: relative;
}
.position{
position: absolute;
left: 0;
width: 100%;
bottom: 0;
}
</style>
<body>
<div class="box">
<input type="text">
<div style='height: 400px'></div>
<div class="position">
底部
</div>
</div>
</body>

  

  在里面添加一个元素,使得内容的高度大于 输入时候 屏幕的高度

  这样就解决了

   

打开input输入的时候,css中position:absolute/fixed定位的时候,定位元素上移问题解决的更多相关文章

  1. (转)实例详解CSS中position的fixed属性使用

    关于fixed属性,在什么情况下需要用,怎么用,首先,我们应该先了解下fixed属性的说明:fixed总是以body为定位时的对象,总是根据浏览器的窗口来进行元素的定位,通过"left&qu ...

  2. CSS中position和header和overflow和background

    <!DOCTYPE html> <!--CSS中position属性--> <html lang="en"> <head> < ...

  3. CSS中Position 的用法详解。

    记得一年前,到一家公司面试的时候,问我position有哪几个属性,我憋半天才回答出2个,大家估计都清楚,就是我们经常用到的2个(relative,absolute). 最近又用到了好多,深入研究了下 ...

  4. 深入理解css中position属性及z-index属性

    深入理解css中position属性及z-index属性 在网页设计中,position属性的使用是非常重要的.有时如果不能认识清楚这个属性,将会给我们带来很多意想不到的困难. position属性共 ...

  5. CSS中Position属性

    也许你看到这个标题觉得很简单,确实这是一篇关于CSS中Position属性基础知识的文章,但是关于Position的一些细节也许你不了解. 1.简介 position有五个属性: static | r ...

  6. CSS中"position:relative"属性与文档流的关系

    前言 近期遇到一个问题--"position:relative"到底会不会导致元素脱离文档流?主流观点是不会,但都给不出一个有说服力的论据.最后我自己佐证了一番,总算有了个结果:& ...

  7. CSS中Position属性static、absolute、fixed、relative

    在html中网页可以看成一个立体的空间,一个完整的页面是由很多个页面堆积形成的,如下图所示   CSS中Position属性有四个可选值,它们分别是:static.absolute.fixed.rel ...

  8. 深入理解css中position属性及z-index属性 https://www.cnblogs.com/zhuzhenwei918/p/6112034.html

    深入理解css中position属性及z-index属性 请看出处:https://www.cnblogs.com/zhuzhenwei918/p/6112034.html 在网页设计中,positi ...

  9. 【css笔记】css中的盒模型和三种定位机制(固定定位,绝对定位,浮动)

    html页面上的元素都可以看成是框组成的,框通过三种定位机制排列在一起就过程了我们看到的页面.而框就是盒模型. 盒模型 1.页面上的每个元素可以看成一个矩形框,每个框由元素的内容,内边距,边框和外边距 ...

随机推荐

  1. Smart Contracts

    A smart contract is a computer code running on top of a blockchain containing a set of rules under w ...

  2. uva10570 Meeting with Aliens

    先证明把每次i放到i位置最后次数最少:感觉,可以,用归纳法? //在序列后再加一个相同的序列,就可以模拟用各个数字开头的情况了每个位置不对的只需要换一次54123 ,5固定->41235变成12 ...

  3. uva1615 Highway

    画图,每个给出点都有对应区间:先sort,再尽量靠右选:很常见的套路了..//注意不要越界(0,L) struct Q //复习结构{ double l,r; Q(double _l,double _ ...

  4. params.row[params.column.key] vue h函数 当前单元格 h函数 div 属性 值或数组 render

    params.row[params.column.key] vue h函数 当前单元格 h函数 div 属性 值或数组 render

  5. JAVA Native Interface (JNI)

    1.  Introduction At times, it is necessary to use native (non-Java) codes (e.g., C/C++) to overcome ...

  6. C程序(1)

  7. 解决Invalid bound statement (not found)(Mybatis的Mapper绑定问题)

    一.问题描述 使用mybatis的项目在本地可以正常运行,但当使用maven或Jenkins打包部署到服务器上时出现了绑定错误,异常信息为: org.apache.ibatis.binding.Bin ...

  8. 122. Best Time to Buy and Sell Stock II@python

    Say you have an array for which the ith element is the price of a given stock on day i. Design an al ...

  9. hdu5126 stars

    题目描述 题解: 和二维的比起来差不多. 但是这是四维偏序. 所以搞一下CDQ套CDQ. CDQ是维度a已经有序,按维度b排序,然后将维度c存入一维数据结构. 所以我们在第一层CDQ中分治处理,将合法 ...

  10. python虚拟环境的搭建及作用

    Python的虚拟环境可以使一个Python程序拥有独立的库library和解释器interpreter,而不用与其他Python程序共享统一个library和interpreter.虚拟环境的好处是 ...