将鼠标悬停在div上并添加HTML/CSS会破坏我的页面流

将鼠标悬停在div上并添加HTML/CSS会破坏我的页面流,html,css,Html,Css,当我将鼠标悬停在div上时,JS会插入新的html,但它会中断页面中的流程。我认为这是我的标题类中的css边距,但我希望标题居中。解决这个问题的最佳方法是什么 .title { width: 100%; height: 30px; text-align: center; margin: 0 auto; background-color: black; color: snow; margin-top: 23%; margin-bott

当我将鼠标悬停在div上时,JS会插入新的html,但它会中断页面中的流程。我认为这是我的标题类中的css边距,但我希望标题居中。解决这个问题的最佳方法是什么

.title {
    width: 100%;
    height: 30px;
    text-align: center;
    margin: 0 auto;
    background-color: black;
    color: snow;
    margin-top: 23%;
    margin-bottom: 0;
}
拨弄

只需添加垂直对齐:顶部:

  .project {
        //your stuff
        vertical-align: top;
  }
这是小提琴的工作原理:


我认为这个css适合您:

/************
INFO
************/

.info {
  width: 100%;
  height: 100%;
}

.title {
  width: 100%;
  height: 30px;
  background-color: black;
  color: snow;
     position: relative;
   top: 50%;
   -webkit-transform: translateY(-50%);
       -ms-transform: translateY(-50%);
           transform: translateY(-50%);

}

嗨,老兄,你的想法在哪方面被打断了。?你能解释一下吗?这样我可以帮忙