2015-02-10 105 views
0

我有2行,一個需要兩個圖像,另一個需要顯示信息,如果這些圖像被點擊。集中具有onclick元素的嵌套Divs

我有一個問題集中在行div中的圖像和文本。

<div id="container"> 
<!-- Image row --> 
<div class="row"> 
    <div class="col-md-6"> 
     <div id="badbutton"><a href="#" onclick="showHide('bad')"></a></div> 
     </div> 
    <div class="col-md-6"> 
     <div id="goodbutton"><a href="#" onclick="showHide('good')"></a></div> 
    </div> 
</div> 

<!-- Text Row --> 

<div class="row"> 
    <div class="col-md-6"> 
     <div id="bad" style="display:none;"> 
      <p>Oh no! We'd appreciate it if you'd share your experience with us so we can improve in the future. Just click below to get started.</p> 
      <p> FORM HERE </p> 
     </div> 
     </div> 
    <div class="col-md-6"> 
      <div id="good" style="display:none;"> 
       <p>Fantastic! Please share your experience with the world on of these popular websites. Just make a selection below to get started.</p> 
       <ol> 
        <li>Click here to review us on Google+ Reviews</li> 
        <li>Click here to review us on Facebook</li> 
       </ol> 
      </div> 
    </div> 
</div> 
</div> 

發生了什麼事是COL-MD-6佔據該行格的45%,但裏面的按鈕不集中自己。

這裏是CSS:

.row { 
    margin: 0 auto; 
} 
.col-md-6 { 
    position: relative; 
    min-height: 1px; 
    padding-right: 15px; 
    padding-left: 15px; 
} 
.col-md-6 { 
    width: 45%; 
} 
#good, 
#bad { 
    width: 50%; 
} 

這裏是結果:

enter image description here

+1

樣品小提琴製作小提琴確切的問題 – Era 2015-02-10 11:49:15

+0

是否使用Twitter的引導來獲得,如果是哪個版本? – abhiklpm 2015-02-10 12:15:26

+0

@abhiklpm我使用了標準引導程序中的行和列元素 – 2015-02-10 12:16:32

回答

0

嘗試使用顯示:表 - *會作出這樣的表格上內容的行爲。

.row { 
margin: 0 auto; 
display: table-row; 
} 

.col-md-6 { 
    position: relative; 
    min-height: 1px; 
    padding-right: 15px; 
    padding-left: 15px; 

    display: table-cell; 
    text-align: center; 
    vertical-align: middle; 
} 
+0

嘿,所以這樣做使得下面的文本看起來好多了,但圖像沒有在中間對齊。 – 2015-02-10 12:08:28

+0

你可以創建一個小提琴來演示你的問題?它會更容易幫助你 – nanndoj 2015-02-10 12:09:58

+0

http://jsfiddle.net/3t4gtrtt/ – 2015-02-10 12:16:08

0

將樣式「text-align:center」賦予「col-md-6」div。並顯示:內嵌塊到#goodbutton和#badbutton。

剛例如

#badbutton, #goodbutton { 
height: 50px; 
width: 50px; 
display: inline-block; 
background: #444; 
vertical-align: middle; 

}這裏 http://jsfiddle.net/Lw27ofb1/

+0

有一個小提琴。 – 2015-02-10 12:20:16

+0

我沒有看到小提琴中的圖像。試試解決方案。它應該工作 – 2015-02-10 12:21:31

+0

圖像被替換爲背景顏色。我試圖解決。它沒有工作 – 2015-02-10 12:22:08