简体   繁体   English

如何防止 html 元素被 CSS 中的其他元素移动?

[英]How to prevent an html element from being moved by other elements in CSS?

I'm almost 100% sure this is a css problem and as I suck at css I have no clue how to remedy it.我几乎 100% 确定这是一个 css 问题,当我对 css 感到厌烦时,我不知道如何解决它。 There are no display modes or positioning specified in the css. css 中没有指定显示模式或位置。 When I spawn in my header elements, the laser beam that the ship is supposed to shoot out is offset and changes positions when the different headers are removed.当我在我的 header 元素中生成时,船舶应该射出的激光束会发生偏移,并且在移除不同的集管时会改变位置。 How can I fix this?我怎样才能解决这个问题? Here is a recording of the website.这是该网站的记录。 http://recordit.co/WkQOViHtUs http://recordit.co/WkQOViHtUs

You could try setting the position in the laser's css to absolute instead of relative with this:您可以尝试将激光的 css 中的 position 设置为绝对值而不是相对值:

position: absolute;

But I don't know if this would work with the other interactions and code you've made.但我不知道这是否适用于您所做的其他交互和代码。 You should copy paste the rest of the code so that we can better understand the problem.您应该复制粘贴代码的rest,以便我们更好地理解问题。

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

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