2017-10-18 215 views
1

我想合併兩個圖像,所以他們使一個,我使用PHP,但我相信我可能會遇到的問題是在bootstrap內。代碼如下,但我得到的圖像之間的間隙按照我附上圖片...圖像之間的差距

問題的圖像可以在可見: http://www.madeinbritain.co.nz/wp-content/themes/afish/images/issue.jpg

的代碼如下,這個問題代碼靠近底部:

<header class="site-header" role="banner"> 
<nav class="site-navigation"> 
    <div class="container-fluid"> 
     <div class="row"> 
      <div class="site-navigation-inner col-sm-12"> 
       <div class="navbar navbar-default" style="position: relative; background-color: red;"> 
        <div class="navbar-header"> 
         <!-- .navbar-toggle is used as the toggle for collapsed navbar content --> 
         <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar-collapse"> 
          <span class="sr-only"><?php _e('Toggle navigation','_tk') ?> </span> 
          <span class="icon-bar"></span> 
          <span class="icon-bar"></span> 
          <span class="icon-bar"></span> 
         </button> 

             <!-- Your site title as branding in the menu --> 
            <?php if (get_theme_mod('andys_logo')) : ?> 
    <div class='site-logo'> 
     <a href='<?php echo esc_url(home_url('/')); ?>' title='<?php echo esc_attr(get_bloginfo('name', 'display')); ?>' rel='home'><img src='<?php echo esc_url(get_theme_mod('andys_logo')); ?>' alt='<?php echo esc_attr(get_bloginfo('name', 'display')); ?>'></a> 
    </div> 
<?php else : ?> 
    <hgroup> 
     <h1 class='site-title'><a href='<?php echo esc_url(home_url('/')); ?>' title='<?php echo esc_attr(get_bloginfo('name', 'display')); ?>' rel='home'><?php bloginfo('name'); ?></a></h1> 
     <h2 class='site-description'><?php bloginfo('description'); ?></h2> 
    </hgroup> 
<?php endif; ?> 

        </div> 
          <div class="getstartedn-wrap"> 
     <a href="#"> 
     <div class="nav-getstarted getstarted-button">GET STARTED</div> 
     </a> 
     </div> 
        <!-- The WordPress Menu goes here --> 
        <?php wp_nav_menu(
         array(
          'theme_location' => 'primary', 
          'depth'    => 2, 
          'container'   => 'nav', 
          'container_id'  => 'navbar-collapse', 
          'container_class' => 'collapse navbar-collapse', 
          'menu_class'  => 'nav navbar-nav', 
          'fallback_cb'  => 'wp_bootstrap_navwalker::fallback', 
          'menu_id'   => 'main-menu', 
          'walker'   => new wp_bootstrap_navwalker() 
         ) 
        ); ?> 
      <div style="overflow: hidden; width: 2500px; position: absolute; left: 50%; bottom: 0; margin-left: -1000px; height: 14px; z-index: 10000;font-size:0px;"><img src="http://www.madeinbritain.co.nz/wp-content/themes/afish/images/water-top.png" height="14px"> 
     </div> 
       </div><!-- .navbar --> 
      </div> 
     </div> 
    </div><!-- .container --> 
</nav><!-- .site-navigation --> 
</header><!-- #masthead --> 

<div class="main-content"> 
<?php // substitute the class "container-fluid" below if you want a wider content area ?> 
    <div class="container-fluid"> 
     <div class="row"> 
      <div id="content" class="main-content-inner col-sm-12 col-md-12" style="position: relative;"> 

    <div style="overflow: hidden; width: 2500px; position: absolute; left: 50%; top: 0; margin-left: -1000px; height: 14px; z-index: 10000; margin-top: 0px; padding-top: 0px;font-size:0px;display: flex;"><img src="http://www.madeinbritain.co.nz/wp-content/themes/afish/images/water-bottom.png" height="14px"> 
     </div> 

任何人都可以提供幫助嗎?

+2

您不包括圖像。你也應該在你的答案中只包含* related *代碼,參見[如何創建一個最小,完整和可驗證的例子](https://stackoverflow.com/help/mcve) – FluffyKitten

+1

你能刪除所有不必要的代碼嗎?圖像鏈接不起作用。 – Cons7an7ine

回答

1

一種解決方案是將font-size:0px設置爲圖像的父級,這將移除父級圖像之間的空間。

.no-space{ 
 
    font-size:0px; 
 
}
<div class="no-space"> 
 
<img src="http://lorempixel.com/200/200/"/> 
 
<img src="http://lorempixel.com/200/200/"/> 
 
<img src="http://lorempixel.com/200/200/"/> 
 
</div>

參考文獻:

  1. Remove Space
+0

感謝這個納仁,雖然還有一個小空間: http://www.madeinbritain.co.nz/wp-content/themes/afish/images/issue.jpg – Afisher

+0

@Afisher正如你可能聽說過的那樣,不容易被注意到,請在圖片上畫一個框並顯示空白處,然後在實際問題中添加一些描述性文字! –

+0

對不起有點困惑你的意思,但我可以重新發布圖像,仍然有一條線在中間 – Afisher

1

做的另一種方式是與Flexbox的

.no-space { 
 
    display: flex; /* displays img's inline */ 
 
}
<div class="no-space"> 
 
    <img src="http://via.placeholder.com/200x200"> 
 
    <img src="http://via.placeholder.com/200x200"> 
 
    <img src="http://via.placeholder.com/200x200"> 
 
</div>

+0

感謝這個VXp,雖然仍然有一個小空間: http://www.madeinbritain.co.nz/可溼性粉劑內容/主題/ afish /圖片/ issue.jpg – Afisher