【问题标题】:CSS: SVG Placement In DIVCSS:在 DIV 中放置 SVG
【发布时间】:2012-10-10 13:33:16
【问题描述】:

这是我的小提琴 - http://jsfiddle.net/UBHj8/

所以我的问题很明显,只是似乎无法让 svg 将搜索栏隐藏在正确的位置。有人可以帮忙吗,这个小错误让我发疯了。

<div class="togglesearch">
    <svg id="hidesearch" xmlns="http://www.w3.org/2000/svg" version="1.1" width="10" height="10" style="margin:0px 0px 0px 10px;">
        <polygon points="10,10  10,0  0,5">
    </svg>

    <svg id="showsearch" xmlns="http://www.w3.org/2000/svg" version="1.1" width="10" height="10" style="margin:10px 0px 0px 10px;">
        <polygon points="0,0  0,10  10,5">
    </svg>
</div>

【问题讨论】:

  • 您想在哪里隐藏搜索栏?
  • 这些按钮只是切换搜索栏的可见性。我的问题是 svg 在可见/显示时的定位。

标签: css svg position


【解决方案1】:

你想要this这样的东西吗?

我只是将 svg 图像绝对定位在容器中,并将垂直位置与搜索框的填充匹配。

【讨论】:

  • 谢谢兄弟,我忘了最小宽度。
猜你喜欢
  • 1970-01-01
  • 2017-11-07
  • 2017-06-08
  • 1970-01-01
  • 1970-01-01
  • 2023-04-09
  • 2015-04-13
  • 2020-03-14
  • 2015-05-04
相关资源
最近更新 更多