2012-10-10 52 views
0

這裏是我的小提琴 - http://jsfiddle.net/UBHj8/CSS:SVG放置在DIV

所以我的問題是很明顯的,只是似乎無法得到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> 
+0

你想隱藏你的搜索欄? –

+0

這些按鈕只是切換搜索欄的可見性。我的問題是svg在可見/顯示時的位置。 –

回答

1

想要類似this的東西嗎?

我認爲絕對定位在容器中的svg圖像,並與垂直位置與搜索框的填充相匹配。

+0

感謝兄弟,我忘記了最小寬度。 –