0
ロゴを中央に水平に配置する必要がありましたので、ブートストラップから.table
と.table-cell
を使用しました。問題は、画像が中央で完全に揃えられている間に、.table-cell
は親の長さの100%になり、<a href>
で折り返すと全幅がクリック可能になります。。表のセル幅は100%になります。<a><img>は全角でクリックできます
コード:
<div class="header-content table">
<div class=" table-cell">
<?php
if(function_exists('the_custom_logo')) {
if(has_custom_logo()) {
$custom_logo_id = get_theme_mod('custom_logo');
$image = wp_get_attachment_image_src($custom_logo_id , 'full');
echo '<a href="'.get_home_url().'"><div class="harmony-logo background-image" style="background-image: url('.$image[0].');">';
echo '</div></a>';
} else {
echo '<h1 class="site-title"><?php bloginfo("name"); ?></h1>';
}
} ?>
</div><!-- .table-cell -->
</div><!-- .header-content -->