0

私はwordpressで簡単なページを作成しました。私はwordpressのカスタムテーマを作った。私がワードプレスで私のページのwyswigエディタで私のページセクションに行くと、私はイメージを置く。問題はイメージポストを持っていて、私はすでにそれをwyswigの中心に揃えていますが、実際のページでそれを見たときにイメージがセンタリングされず、モバイルビューになるとイメージが応答しなくなり、まだそれは動作しません。ここでWordPressのポストページイメージは、中央に配置することができません。

は私のコードです:ここでは

<?php 
/* 
    Template Name: Custom Page 
*/ 

get_header(); ?> 
<div id="wrapper"> 
<section id="custom"> 
    <div class="container"> 

     <?php 
     if (have_posts()) { 
      while (have_posts()) { 
       the_post(); ?> 
       <h2><?php the_title(); ?></h2> 
       <hr width="30%" align="left"> 
       <p><?php the_content(); ?></p> 
      <?php } // end while 
     } // end if 
     ?> 

    </div> 

</section> 
<?php get_footer(); ?> 
</div> 

はmaxWidthに460と私のCSSの@mediaクエリです:

#custom img { 
     width: 100%; 
     height: auto; 
    } 
    #custom h2 { 
    margin-top: 32%; 
    } 

答えて

0

あなたが探しているものmax-widthプロパティです。

必ずしもメディアクエリ内の仕方によっては、

#custom img { 
    // So we can center it 
    display:inline-block; 
    // Limit the size : 
    max-width: 100%; 
} 

のようなものは、その後、あなたのメディアクエリで、あなたはmax-width

max-width:50%;ように適応させることができます
関連する問題