【问题标题】:Css styling stepsCSS样式步骤
【发布时间】:2014-08-20 05:38:29
【问题描述】:

我正在使用带有引导程序的 Jquery 步骤。我创建了自定义 CSS 来设置步骤列表的样式。

我的 CSS 是

.steps li {
    padding: 7px 4px 10px;
    margin-right: 5px;
    background: #dedede;
    position: relative;
    display: inline-block;
}
.steps li:before {
    width: 0;
    height: 0;
    border-top: 17px inset transparent;
    border-bottom: 20px inset transparent;
    border-left: 20px solid #fff;
    position: absolute;
    content: "";
    top: 0;
    left: 0;
}
.steps li:after {
    width: 0;
    height: 0;
    border-top: 18px inset transparent;
    border-bottom: 17px inset transparent;
    border-left: 20px solid #dedede;
    position: absolute;
    content: "";
    top: 0;
    right: -20px;
    z-index: 2;
}
.steps .badge {
    margin: 0 2px 0 19px;
    position: relative;
    top: -1px;
}

还有,我的部分步骤列表,

1)

<p>Correct</p>
<div class="steps">
<ul>
    <li role="tab" class="disabled" aria-disabled="true">
    <a aria-controls="wizard-p-2" href="#wizard-h-2" id="wizard-t-2">
        <span class="badge">3</span> Review Contributors
    </a>
    </li>
</ul>
</div>

2)

<p>Wrong</p>
<div class="steps">
<ul>
    <li role="tab" class="disabled" aria-disabled="true">
        <a aria-controls="wizard-p-2" href="#wizard-h-2" id="wizard-t-2">
            <span class="badge">3</span> Review<br/> Contributors
            </a>
    </li>
</ul>
</div>

在这里,第一个工作正常。但是第二个由于Review&lt;br/&gt; Contributors 中的&lt;br/&gt; 而破坏了样式。请看我的Fiddle。我想要做的是,如果文本长度太长,我想用相同的样式打破文本。怎么做?我试过display:table 属性。但它不起作用。

我使用&lt;br/&gt; 来减小大小。但我需要与 1) 相同的结果。我需要使用任何其他来代替&lt;br/&gt;

【问题讨论】:

  • 你能扩展“打破样式”吗?通过告诉我们样式的哪一部分损坏了?
  • 你能看看我的小提琴吗?它打破了我用于li 的风格
  • 1) 我做了... 2) 它没有告诉我问题出在哪里。是的……休息会让它看起来很糟糕……所以不要在那里休息。 3) 小提琴不会永远持续下去,但 Stack Overflow 问题会...您应该将所有相关信息放入 Stack Overflow 上的问题中
  • 删除br?我不明白你的问题
  • 啊啊没关系,我想我终于找到你了。让我检查一下

标签: jquery html css twitter-bootstrap jquery-steps


【解决方案1】:

试试这个,see fiddle

<p>Correct</p>
<div class="steps">
    <ul>
        <li role="tab" class="disabled" aria-disabled="true"> <a aria-controls="wizard-p-2" href="#wizard-h-2" id="wizard-t-2">
            <span class="badge">3</span> Review Contributors
        </a>

        </li>
    </ul>
</div>
<p>Wrong</p>
<div class="steps">
    <ul>
        <li role="tab" class="disabled" aria-disabled="true"> <a aria-controls="wizard-p-2" href="#wizard-h-2" id="wizard-t-2">
                <span class="badge">3</span> Review Contributors
                </a>

        </li>
        <li role="tab" class="disabled" aria-disabled="true"> <a aria-controls="wizard-p-2" href="#wizard-h-2" id="wizard-t-2">
                <span class="badge">3</span> Review Contributors
                </a>

        </li>
        <li role="tab" class="disabled" aria-disabled="true"> <a aria-controls="wizard-p-2" href="#wizard-h-2" id="wizard-t-2">
                <span class="badge">3</span> Review Contributors
                </a>

        </li>
        <li role="tab" class="disabled" aria-disabled="true"> <a aria-controls="wizard-p-2" href="#wizard-h-2" id="wizard-t-2">
                <span class="badge">3</span> Review Contributors
                </a>

        </li>
        <li role="tab" class="disabled" aria-disabled="true"> <a aria-controls="wizard-p-2" href="#wizard-h-2" id="wizard-t-2">
                <span class="badge">3</span> Review Contributors
                </a>

        </li>
        <li role="tab" class="disabled" aria-disabled="true"> <a aria-controls="wizard-p-2" href="#wizard-h-2" id="wizard-t-2">
                <span class="badge">3</span> Review Contributors
                </a>

        </li>
        <li role="tab" class="disabled" aria-disabled="true"> <a aria-controls="wizard-p-2" href="#wizard-h-2" id="wizard-t-2">
                <span class="badge">3</span> Review Contributors
                </a>

        </li>
        <li role="tab" class="disabled" aria-disabled="true"> <a aria-controls="wizard-p-2" href="#wizard-h-2" id="wizard-t-2">
                <span class="badge">3</span> Review Contributors
                </a>

        </li>
    </ul>
</div>

和 CSS

.steps li {
    margin-right: 2px;
    background: #dedede;
    position: relative;
    display: inline-block;
    width:11.5%;
    font-size:12px;
    padding:20px 0 10px 10px;
    text-align:center;
}
.steps li:before {
    width: 0;
    height: 0;
    border-top: 41px inset transparent;
    border-bottom: 40px inset transparent;
    border-left: 20px solid #fff;
    position: absolute;
    content:"";
    top: 0;
    left: 0;
}
.steps li:after {
    width: 0;
    height: 0;
    border-top: 41px inset transparent;
    border-bottom: 40px inset transparent;
    border-left: 20px solid #dedede;
    position: absolute;
    content:"";
    top: 0;
    right: -20px;
    z-index: 2;
}
.steps .badge {
    margin: 0 2px 0 19px;
    position: relative;
    top: -3px;
}

【讨论】:

  • 这是您所描述问题的确切解决方案,如果您想要其他东西,您可以更好地解释事情,或者添加一些您自己的样式,我无法读心。但是谢谢你的反对,你提醒了我为什么我避开这个网站
  • +1,感谢您的帮助,我解决了我的问题。谢谢
【解决方案2】:
    .steps a {
        font-weight: bolder;
    }

    .wizard > .content > .body ul > li {
        display: table;
    }


    .nav-tabs > li.active > a, .nav-tabs > li.active > a:focus, .nav-tabs > li.active > a:hover {
        color: white;
        cursor: default;
        background-color: #f60000;
        border: 1px solid #ddd;
        border-bottom-color: transparent;
    }

    .nav-tabs > li > a:hover {
        border-color: #eee #eee #ddd;
    }

    .nav > li > a:focus, .nav > li > a:hover {
        text-decoration: none;
        background-color: #eee;
    }

    .nav-tabs > li > a {
        margin-right: 2px;
        line-height: 1.42857143;
        border: 1px solid transparent;
        border-radius: 4px 4px 0 0;
    }

    .nav > li > a {
        position: relative;
        display: block;
        padding: 10px 15px;
    }

    .customerrow:hover {
        background-color: steelblue;
        color: white;
    }

    .modal {
        background-color: #5665928f;
    }

    .modal-dialog {
        max-width: 800px;
    }

    .list-group-item {
        display: inline;
        border: 0px
    }

    body {
        font-size: 14px;
        font-family: Arial, Helvetica, sans-serif;
    }

    button, input, select, textarea {
        font-family: inherit;
        font-size: inherit;
        line-height: inherit;
    }
    /* jquery validation */
    label.error {
        color: #e7505a;
        margin-left: 10px;
        padding: 7px;
    }

    input.error {
        border: 2px solid #e7505a;
    }


    .steps li {
        margin-right: 2px;
        background: #2184be;
        position: relative;
        display: inline-block;
        width: 11.5%;
        font-size: 12px;
        padding: 20px 0 10px 10px;
        text-align: center;
    }

    li.done {
        background: #718781;
        margin-right: 2px;
        position: relative;
        display: inline-block;
        width: 11.5%;
        font-size: 12px;
        padding: 20px 0 10px 10px;
        text-align: center;
    }

        .steps li:before {
            width: 0;
            height: 0;
            border-top: 41px inset transparent;
            border-bottom: 40px inset transparent;
            border-left: 20px solid #fff;
            position: absolute;
            content: "";
            top: 0;
            left: 0;
        }

    .wizard > .steps .done a {
        background: #718781;
        color: #fff;
    }

        .wizard > .steps .done a:hover {
            background: #718781;
            color: #fff;
        }
    .steps li:after {
        width: 0;
        height: 0;
        border-top: 41px inset transparent;
        border-bottom: 40px inset transparent;
        border-left: 20px solid #2184be;
        position: absolute;
        content: "";
        top: 0;
        right: -20px;
        z-index: 2;
    }

    .wizard > .steps .disabled a {
        background: #2184be;
        color: black;
        cursor: default;
    }
        .steps .badge {
        margin: 0 2px 0 19px;
        position: relative;
        top: -3px;
    }

   .wizard ul > li{
       padding:12px;
   }

    .wizard > .steps .disabled a:hover {
        background: #2184be;
        color: black;
        cursor: default;
    }

【讨论】:

    猜你喜欢
    • 2019-02-16
    • 1970-01-01
    • 2019-02-22
    • 1970-01-01
    • 1970-01-01
    • 2020-03-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多