1

这在 Firefox/Chrome 中有效,但在 IE 中,此滑块的红色滑块会碰到视口外的下一行。

绿色和红色边和手柄都向左浮动。我尝试应用 300px 宽度来.stSlide思考幻灯片的宽度可能会迫使红色部分被推到下一行,但这并没有解决它。

http://plnkr.co/edit/xqYBnz5BHLP844kXJXKs?p=preview

.ngSlideToggle {
    cursor: pointer;
    visibility: hidden;
    height: 28px;
}
.ngSlideToggle * {
    box-sizing: content-box;
}
.ngSlideToggle > input[type=checkbox] {
    display: none;
}
.ngSlideToggle > .stSlide {
    transition: all 0.2s ease-in-out;
}
.stSlide > .stOff,
.stSlide > .stOn,
.stSlide > .stHandle {
    display: block;
    float: left;
    font-family: Arial, Helvetica, sans-serif;
    line-height: 22px;
    font-size: 12px;
}
.stSlide > .stOff,
.stSlide > .stOn {
    padding: 4px 10px;

    color: #fff;
    text-align: center;
    white-space: nowrap;
    font-size: 11px;
    line-height: 18px;
    font-weight: bold;
    text-transform: uppercase;
    text-shadow: 0 1px #808080;
}
.stSlide > .stHandle {
    padding: 2px 1px 2px 0;
    min-width: 25px;
    background: #fdfdfd; /* Old browsers */
    background: -o-linear-gradient(top,  #fdfdfd 0%,#ebebeb 100%); /* Opera 11.10+ */
    background: linear-gradient(to bottom,  #fdfdfd 0%,#ebebeb 100%); /* W3C */
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fdfdfd', endColorstr='#ebebeb',GradientType=0 ); /* IE6-9 */

    border: 1px solid #ADADAD;
    color: #c6c6c6;
    letter-spacing: -1px;
    text-align: center;
}
.stSlide > .stOn {
    background: #8ab056; /* Old browsers */
    background: -o-linear-gradient(top,  #8ab056 0%,#a2c46b 100%); /* Opera 11.10+ */
    background: linear-gradient(to bottom,  #8ab056 0%,#a2c46b 100%); /* W3C */
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#8ab056', endColorstr='#a2c46b',GradientType=0 ); /* IE6-9 */
    border: 1px solid #88a75c;
    border-right: none;
    border-top-left-radius: 3px;
    border-bottom-left-radius: 3px;
}
.stSlide > .stOff {
    background: #d4786a; /* Old browsers */
    background: -o-linear-gradient(top,  #d4786a 0%,#e39080 100%); /* Opera 11.10+ */
    background: linear-gradient(to bottom,  #d4786a 0%,#e39080 100%); /* W3C */
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#d4786a', endColorstr='#e39080',GradientType=0 ); /* IE6-9 */
    border: 1px solid #bd6e61;
    border-left: none;
    border-top-right-radius: 3px;
    border-bottom-right-radius: 3px;
}
4

1 回答 1

0

尝试用这个替换CSS .stSlide > .stOff, .stSlide > .stOn, .stSlide > .stHandle

.stSlide > .stOff,
.stSlide > .stOn,
.stSlide > .stHandle {
    display: inline-block;
    font-family: Arial, Helvetica, sans-serif;
    line-height: 22px;
    font-size: 12px;
}

我在这里所做的,我更改displayinline-block并删除了float.
很难说这是否会奏效,因为对我来说,从一开始一切都很好。
但这可能会有所帮助。

编辑

您还可以将此属性添加到.stSlide

overflow: visible;
white-space: nowrap;

以确保跨度将保持在同一行。

于 2013-10-08T17:02:52.663 回答