2016-09-23 73 views
-1

我需要採取兩個元素,並關閉他們,一個接近另一個。我需要用CSS做這個,所以這是我的html代碼:如何把兩個元素關閉CSS?

<section class="vc_row section-wrapper vc_custom_1453226174905 vc_row-has-fill"> 
    <div class="container"> 
    <div class="row"> 
     <div class="wpb_column vc_column_container vc_col-sm-6 vc_col-md-4"> 
     <div class="vc_column-inner "> 
      <div class="wpb_wrapper"> 

      <div class="spotlight-wrap spotlight-default "> 

       <figure class="tt-effect"> 

       <img src="http://andrejceccoli.com/wp-content/uploads/2016/09/programmaPolitico.jpg" alt="Programma Elettorale"> 

       <figcaption> 
        <h2>Programma Elettorale</h2>   
        <div class="content"> 
         <p>Tutti i punti del mostro programma elettorale.</p> 
         <a class="btn btn-outline " href="http://andrejceccoli.com/?page_id=15" title="">Leggi di più</a> 
        </div> 
       </figcaption> 
       </figure> 
      </div> <!-- spotlight-wrap --> 

//任何人都可以幫我嗎?

  //NEW FIGURE 
       <figure class="tt-effect"> 
       <img src="http://trendytheme.net/demo2/wp/nominee/onepage/wp-content/uploads/2015/11/Issues-one-page-360x250.jpg" alt="Issues"> 
       <figcaption> 
        <h2>Issues</h2>     
        <div class="content"> 
        <p>Rapidiously integrate plug-and-play channels rather than cost effective ideas.</p> 

        <a class="btn btn-outline " href="http://trendytheme.net/demo2/wp/nominee/onepage/issue-right-sidebar/" title="">Learn more</a> 
        </div> 
       </figcaption>  
       </figure> 
      </div> <!-- spotlight-wrap --> 
      </div> 
     </div> 
     </div> 
    </div> 
    </div> 
</section> 

我怎樣才能做到這一點?用css?

+0

你嘗試過什麼嗎?這兩個元素需要互相靠近 – depperm

+0

我嘗試「display:inline-block;」但它不起作用 – Ashe

+0

請說明您的具體問題或添加其他詳細信息,以確切地突出顯示您的需求。正如目前所寫,很難確切地說出你在問什麼。 –

回答

-1

嘗試float: left;。否則,提供更多信息將是一件好事。例如,哪些元素需要彼此靠近。

啊,如果你使用浮點數,做下一個元素clear: both;。否則你的設計可能會被破壞。

1

只需添加CSS樣式figure標籤:

figure { 
    display: inline-block; 
    float: left; 
} 

figure { 
 
\t display: inline-block; 
 
}
<section class="vc_row section-wrapper vc_custom_1453226174905 vc_row-has-fill"> 
 
    <div class="container"> 
 
    <div class="row"> 
 
     <div class="wpb_column vc_column_container vc_col-sm-6 vc_col-md-4"> 
 
     <div class="vc_column-inner "> 
 
      <div class="wpb_wrapper"> 
 

 
      \t <figure class="tt-effect"> 
 
       <img src="http://andrejceccoli.com/wp-content/uploads/2016/09/programmaPolitico.jpg" alt="Programma Elettorale"> 
 
       <figcaption> 
 
        <h2>Programma Elettorale</h2>   
 
        <div class="content"> 
 
         <p>Tutti i punti del mostro programma elettorale.</p> 
 
         <a class="btn btn-outline " href="http://andrejceccoli.com/?page_id=15" title="">Leggi di più</a> 
 
        </div> 
 
       </figcaption> 
 
       </figure> 
 

 
       <figure class="tt-effect"> 
 
       <img src="http://trendytheme.net/demo2/wp/nominee/onepage/wp-content/uploads/2015/11/Issues-one-page-360x250.jpg" alt="Issues"> 
 
       <figcaption> 
 
        <h2>Issues</h2>     
 
        <div class="content"> 
 
        <p>Rapidiously integrate plug-and-play channels rather than cost effective ideas.</p> 
 

 
        <a class="btn btn-outline " href="http://trendytheme.net/demo2/wp/nominee/onepage/issue-right-sidebar/" title="">Learn more</a> 
 
        </div> 
 
       </figcaption>  
 
       </figure> 
 

 
      </div> <!-- spotlight-wrap --> 
 
      </div> 
 
     </div> 
 
     </div> 
 
    </div> 
 
    </div> 
 
</section>