【发布时间】:2012-06-01 19:17:35
【问题描述】:
我正在尝试创建一些圆角的 div(应该是按钮)。我可以使用border-radius.htc 或PIE.htc 来实现它。
我使用 margin-top 来定位它们。流向下方另一个 div 的按钮部分不可见,它应该是不可见的。查看截图:
.menu_buttons{
margin-top:45px;
overflow: visible;
margin-left: 10px;
width: 85px;
height: 3em;
vertical-align: middle;
float:left;
cursor: pointer;
text-align: center;
font: 0.9em Arial, Helvetica, sans-serif;
border-radius: 10px;
behavior: url(PIE.htc);
}
.对角线:
.diagonal{
background-image: linear-gradient(left top, #CFD993 30%, #8DA900 68%);
background-image: linear-gradient(-45deg, #CFD993 30%, #8DA900 68%);
background-image: -o-linear-gradient(left top, #CFD993 30%, #8DA900 68%);
background-image: -moz-linear-gradient(-45deg left top, #CFD993 30%, #8DA900 68%);
background-image: -webkit-linear-gradient(135deg, #CFD993 30%, #8DA900 68%);
background-image: -ms-linear-gradient(left top, #CFD993 30%, #8DA900 68%);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#CFD993', endColorstr='#8DA900', GradientType=1);
/*background: #CFD993;*/
background-image: -webkit-gradient(
linear,
left top,
right bottom,
color-stop(0.3, #CFD993),
color-stop(0.68, #8DA900)
);
}
我的部分html:
<div class="diagonal" id="section1">
<img alt="SMIC Service Management In the Cloud" src="/images/smic_small.png" id="smic">
<div class="link_menu">
<button class="menu_buttons ui-corner-all smic_green" id="overview">Overview</button>
<!--Some more <div....-->
<button class="menu_buttons ui-corner-all smic_green" id="usage_benchmark">SMICloud<br>usage<br>benchmark</button>
<a class="menu_items" id="get_smic">Get SMICloud</a>
<!--Some more <a....-->
<a class="menu_items" id="contact">Contact</a>
</div>
</div>
将以下内容添加到 .diagonal 会根据以下屏幕截图更改外观:
position: relative;
z-index: -1;
当尝试将 z-index -10 添加到 #section1 下方的 div 时,没有任何反应。
我完全被困住了。我该如何做到这一点,创建一个圆角的 div 溢出到另一个 div?
【问题讨论】:
-
我推荐CSS3Pie 作为 IE 中圆角的最佳解决方案。它还使用 HTC 文件,就像您的示例中的文件一样,但它很容易成为最好的文件。此外,它还处理 CSS 框阴影和渐变。此外,如果您仍有问题,CSS3Pie 网站提供了一些避免常见问题的好技巧。
-
刚刚也试过了。我对上面做了一些更改,而不是使用相对位置,我尝试使用 margin-tops 定位 div(现在是按钮),现在我可以正确定位它。现在的问题是按钮仅在#section1 中可见,它在流到下面的 div 的地方被剪切并且不可见(溢出:可见;没有帮助)。
标签: html css internet-explorer-8 rounded-corners