0

我有一些类似 Google+ 的圈子,但我似乎无法让该overflow物业与他们合作。我认为这与z-index圆圈的属性有关,尽管我尝试将z-indexdiv 设置为覆盖它而没有运气。

jsFiddle

HTML:

<div class="container">
   <div class="circle">
      <div class="outer-circle"></div>
      <div class="middle-circle"></div>
      <div class="inner-circle">4</div>
   </div>
   <div class="circle">
      <div class="outer-circle"></div>
      <div class="middle-circle"></div>
      <div class="inner-circle">3</div>
   </div>
   <div class="circle">
      <div class="outer-circle"></div>
      <div class="middle-circle"></div>
      <div class="inner-circle">2</div>
   </div>
   <div class="circle">
      <div class="outer-circle"></div>
      <div class="middle-circle"></div>
      <div class="inner-circle">1</div>
   </div>
</div>​

CSS:

div.container {
    height: 125px;
    width: 400px;
    overflow: scroll;
    border: 1px solid black;
}
div.circle {
    margin-left: 10px;
    margin-right: 10px;
    width: 130px;
    height: 130px;
    float: left;
}
div.circle:hover {
    cursor: pointer;
}
div.outer-circle {
    background: transparent;
    width: 122px;
    height: 122px;
    -webkit-border-radius: 61px;
    -moz-border-radius: 61px;
    border-radius: 61px;
    border: 1px solid #aaaaaa;
    position: absolute;
    z-index: 800;
    -webkit-transition: all .2s ease-in-out;
    -moz-transition: all .2s ease-in-out;
    -o-transition: all .2s ease-in-out;
    transition: all .2s ease-in-out;
}
div.outer-circle.hover {
    -moz-transform: scale(1.45);
    -webkit-transform: scale(1.45);
    transform: scale(1.45);
}
div.middle-circle {
    margin: 1px;
    width: 122px;
    height: 122px;
    -webkit-border-radius: 61px;
    -moz-border-radius: 61px;
    border-radius: 61px;
    background: #ececec;
    background: -moz-linear-gradient(top, #ececec 0%, #d8d8d8 100%); /* FF3.6+ */
    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#ececec), color-stop(100%,#d8d8d8)); /* Chrome,Safari4+ */
    background: -webkit-linear-gradient(top, #ececec 0%,#d8d8d8 100%); /* Chrome10+,Safari5.1+ */
    background: -o-linear-gradient(top, #ececec 0%,#d8d8d8 100%); /* Opera11.10+ */
    background: -ms-linear-gradient(top, #ececec 0%,#d8d8d8 100%); /* IE10+ */
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ececec', endColorstr='#d8d8d8',GradientType=0 ); /* IE6-9 */
    background: linear-gradient(top, #ececec 0%,#d8d8d8 100%); /* W3C */
    position: absolute;
    z-index: 900;
    -webkit-transition: all .2s ease-in-out;
    -moz-transition: all .2s ease-in-out;
    -o-transition: all .2s ease-in-out;
    transition: all .2s ease-in-out;
}
div.middle-circle.hover {
    -moz-transform: scale(1.4);
    -webkit-transform: scale(1.4);
    transform: scale(1.4);
}
div.inner-circle {
    margin: 14px;
    background: #3C4049;
    width: 96px;
    height: 96px;
    font-size: 11px;
    color: #FFF;
    line-height: 96px;
    text-align: center;
    font-family: Arial;
    -webkit-border-radius: 48px;
    -moz-border-radius: 48px;
    border-radius: 48px;
    -webkit-box-shadow: inset 0px 1px 1px 0px #575757;
    -moz-box-shadow: inset 0px 1px 1px 0px #575757;
    box-shadow: inset 0px 1px 1px 0px #575757;
    border-bottom: 1px solid #FFF;
    position: absolute;
    z-index: 1000;
}
4

3 回答 3

1

尝试这个:

div.container {
    height: 125px;
    width: 400px;
    overflow: auto;
    border: 1px solid black;
    position: relative;
}
div.circle {
    margin-left: 10px;
    margin-right: 10px;
    width: 130px;
    height: 130px;
    float: left;
    position: relative;
}

现场演示:jsFiddle

于 2012-07-31T16:21:24.480 回答
0

多么巧合。我只是在寻找一种使用滚动条将元素扩展到其他元素之外的方法,而您偶然发现了它。

要解决此问题,只需添加position: relative;到您的div.container.

于 2012-07-31T16:23:26.670 回答
0

style="overflow:visible"? 如果这不是您所要求的,请更具体地说明您想要发生的事情。

于 2012-07-31T16:18:45.480 回答