如何修复div的大小?

Jav*_*s ღ 2 html css

嗨,我已经采取了一个<a>标签,并在其上一个其他div打开.在标签下方我已经拍摄了其他显示的div.但当我将鼠标悬停在<a>标签上时,其他div会打开,但<a>标签下面的常规div会更改它的位置并向下移动.所以我想要,虽然在悬停<a>标签时新的div打开常规div不应该改变它的位置.新div应该打开或显示在现有div上.

jsfiddle为它演示

我的代码:

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Reading Image</title>
    <style type="text/css">
        .testtmpblock{
            display: none;
            background-color:black;
            min-height: 100px;
            width: 200px;

        }
        .tmpd{
            height: 100px;
            width: 100px;
            background-color: blue;
        }
        .tt{
            height: 120px;
            width: 100px;
            background-color: fuchsia;
            position: fixed;display: block;
        }
    </style>
    <script src="jquery.min.js" type="text/javascript"></script>
    <script>

        $(document).ready(function () {
      $(document).on('mouseenter', '.cart', function () {


          $(this).next(".testtmpblock").show();
      }).on('mouseleave', '.cart', function () {
          $(this).next(".testtmpblock").hide();
      });
  });


    </script>
</head>
<body>
    <a href="#" class="cart"> Cart </a><div class="testtmpblock"></div>
    <div class="tt">hello</div>

</body>
</html>
Run Code Online (Sandbox Code Playgroud)

有任何建议吗?

Gab*_*oli 5

设置position.testtmpblockabsolute

.testtmpblock{
        display: none;
        background-color:black;
        min-height: 100px;
        width: 200px;
        position:absolute;
    }
Run Code Online (Sandbox Code Playgroud)

http://jsfiddle.net/jXDBN/2/上演示