简体   繁体   English

相对职位问题

[英]Relative position issue

An element with position: relative; position: relative;的元素position: relative; is positioned relative to its normal position. 相对于其正常位置定位。

Setting the top, right, bottom, and left properties of a relatively-positioned element will cause it to be adjusted away from its normal position. 设置相对放置的元素的top,right,bottom和left属性将导致其偏离其正常位置进行调整。 Other content will not be adjusted to fit into any gap left by the element. 其他内容将不进行调整以适合元素留下的任何间隙。

Here is the source: CSS Positioning 来源: CSS定位

Now,how can I make relative position to work as viewport and adjust accordingly by setting height,width etc like fixed position. 现在,如何设置相对位置以用作视口并通过设置高度,宽度等固定位置来进行相应调整。 It is possible in css or not? 有可能在CSS吗? If not then how can I do? 如果没有,我该怎么办?

Check this Fiddle 检查这个小提琴

Try it: 试试吧:

div{
POSITION: relative; 
TOP: 450px; LEFT: 651px; 
width: calc(100% - 651px);
float: left;
}

You can also use javascript or jquery to do it. 您也可以使用javascript或jquery来做到这一点。

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

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