【问题标题】:How to style dropdown buttons using Zurb Foundation 5?如何使用 Zurb Foundation 5 设置下拉按钮的样式?
【发布时间】:2014-01-01 14:59:56
【问题描述】:

我正在使用 Zurb Foundation 5 和 Sass 混合,我想更改下拉箭头的样式。我很确定它位于这里的某个地方,但我不确定它是什么:

// Dropdown Buttons

// $include-html-button-classes: $include-html-classes;

// We use these to set the color of the pip in dropdown buttons
// $dropdown-button-pip-color: #fff;
// $dropdown-button-pip-color-alt: #333;

// $button-pip-tny: rem-calc(6);
// $button-pip-sml: rem-calc(7);
// $button-pip-med: rem-calc(9);
// $button-pip-lrg: rem-calc(11);

// We use these to style tiny dropdown buttons
// $dropdown-button-padding-tny: $button-pip-tny * 7;
// $dropdown-button-pip-size-tny: $button-pip-tny;
// $dropdown-button-pip-opposite-tny: $button-pip-tny * 3;
// $dropdown-button-pip-top-tny: -$button-pip-tny / 2 + rem-calc(1);

// We use these to style small dropdown buttons
// $dropdown-button-padding-sml: $button-pip-sml * 7;
// $dropdown-button-pip-size-sml: $button-pip-sml;
// $dropdown-button-pip-opposite-sml: $button-pip-sml * 3;
// $dropdown-button-pip-top-sml: -$button-pip-sml / 2 + rem-calc(1);

// We use these to style medium dropdown buttons
// $dropdown-button-padding-med: $button-pip-med * 6 + rem-calc(3);
// $dropdown-button-pip-size-med: $button-pip-med - rem-calc(3);
// $dropdown-button-pip-opposite-med: $button-pip-med * 2.5;
// $dropdown-button-pip-top-med: -$button-pip-med / 2 + rem-calc(2);

// We use these to style large dropdown buttons
// $dropdown-button-padding-lrg: $button-pip-lrg * 5 + rem-calc(3);
// $dropdown-button-pip-size-lrg: $button-pip-lrg - rem-calc(6);
// $dropdown-button-pip-opposite-lrg: $button-pip-lrg * 2.5;
// $dropdown-button-pip-top-lrg: -$button-pip-lrg / 2 + rem-calc(3);

这是我所拥有的:

我希望下拉箭头看起来更像这样:

我怎样才能做到这一点?提前致谢!

===== 编辑 ===== 有了这个 scss:

.dropdown.button:before{
  width: 15px;
  height: 15px;
  border: none;
  background: url("../images/dropdown.png") no-repeat;
}

还有这个html:

 <a href="#" data-dropdown="drop" class="button login dropdown width-limit">fake@emailaddress.com</a><br>
      <ul id="drop" data-dropdown-content class="f-dropdown">

按钮如下所示:

我现在如何移动箭头? 更新jsfiddle:http://jsfiddle.net/Y4jDW/

【问题讨论】:

    标签: css sass zurb-foundation mixins


    【解决方案1】:

    您的示例中没有默认箭头фы,但您可以覆盖 Foundation 的样式。只需添加这些样式:

    .dropdown.button:before{
      width: 10px;  //width of your arrow
      height: 10px; //height of your arrow
      border: none;
      background: url(...) no-repeat;  //url for image
    }
    

    【讨论】:

    • 谢谢! @SlawaEremkin 这很好用,只是我不知道如何定位我添加到按钮的图像。这是我目前拥有的一个 jsfiddle:jsfiddle.net/Y4jDW 你能帮帮我吗?
    • 我在我的问题中添加了一些信息。你觉得你能帮我吗?
    【解决方案2】:

    您可以在 css/foundation.css line:1261 中找到该类

    这是原始代码:

        .top-bar-section .has-dropdown > a:after {
        content: "";
        display: block;
        width: 0;
        height: 0;
        border: inset 5px;
        border-color: rgba(168, 168, 168, 1) transparent transparent transparent;
        border-top-style: solid;
        margin-top: -2.5px;
        top: 22.5px; }
    

    你可以试试这个:

        .top-bar-section .has-dropdown > a:after {
        content: "";
        display: block;
        width: 10px;
        height: 10px;
        border: none;
        background-image: url(img/arrow.png) no-repeat;
        margin-top: -2.5px;
        top: 22.5px; }
    

    祝你好运!

    【讨论】:

    • 感谢您的帮助。我在我的foundation.css 文件中的line:4052 上找到了它。我完全改变了你所说的,我的网站上什么也没发生。我需要做些什么才能使更改生效吗?
    猜你喜欢
    • 1970-01-01
    • 2013-11-29
    • 2023-04-01
    • 2013-11-23
    • 1970-01-01
    • 1970-01-01
    • 2013-08-28
    • 1970-01-01
    • 2014-02-28
    相关资源
    最近更新 更多