无法居中对齐主页面

时间:2017-06-12 19:49:44

标签: html css wordpress alignment

我有一个WordPress主页,所有内容都与左边对齐。我想将它们移到中心> http://www.architravel.com/destinations/

请您解释一下我需要做些什么才能让它居中?

这是主页的代码:

<?php
/**
 * Template Name: Home page
 *
 *
 */

get_header(); ?>

<table width="100%" border="0" align="left" cellpadding="0" cellspacing="0">
<tr>
    <td height="200" colspan="2" valign="bottom">
    </td>
</tr>
<tr>
    <td colspan="2" valign="bottom">
        <a href="<?php get_home_url(); ?>"><img src="<?php echo get_template_directory_uri(); ?>/images/destinations_top.jpg" alt="Architravel Destinations" width="518" height="56" border="0"> <div style="clear:both;"></div></a>
    </td>
</tr>
<tr>
    <td colspan="2" bgcolor="#506DAF">
        <img src="<?php echo get_template_directory_uri(); ?>/images/top.jpg" width="1230" height="257" alt="top" >
    </td>
</tr>
<tr>
    <td valign="top" colspan="2">
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
            <td width="405" height="102" valign="top" >
                <a href="http://www.architeam.org/#/projects" target="_blank"><img src="<?php echo get_template_directory_uri(); ?>/images/architeam.jpg" alt="Architeam Projects" width="410" height="102" border="0"></a>
            </td>
            <td valign="top">
                <img src="<?php echo get_template_directory_uri(); ?>/images/planebottom.jpg" align="left" alt="top_bottom">
            </td>
        </tr>
        </table>
        <a href="http://www.architeam.org/#/projects" target="_blank"></a>
    </td>
</tr>
<tr>
    <td colspan="2">
        <table border="0" cellspacing="0" cellpadding="0">
        <tr>
            <td height="50" colspan="10" valign="top">
                &nbsp;
            </td>
        </tr>
        <tr>
            <td width="190" valign="top">
                &nbsp;
            </td>
            <td width="25" valign="top">
                <img src="<?php echo get_template_directory_uri(); ?>/images/doty.jpg" width="20" height="18" alt="doty">
            </td>
            <td valign="middle" style="vertical-align: middle;">
                 Last Destination: &nbsp;
            </td>
            <td width="350" valign="middle" style="vertical-align: middle;">
                <a href="/destinations/trips/los-angeles-las-vegas-san-francisco/" class="front">LOS ANGELES - LAS VEGAS - SAN FRANCISCO</a><br/>
            </td>
            <td width="25" valign="top">
                <img src="<?php echo get_template_directory_uri(); ?>/images/doty.jpg" width="20" height="18" alt="doty">
            </td>
            <td valign="middle" style="vertical-align: middle;">
                Destinations Archive: &nbsp;
            </td>
            <td valign="middle" style="vertical-align: middle;">
                                <a href="/destinations/trips/mexico/" class="front">MEXICO</a> |
                <a href="/destinations/trips/singapore-malaysia/" class="front">SINGAPORE - MALAYSIA</a> | 
                <a href="/destinations/trips/china" class="front">CHINA</a> | 
                <a href="/destinations/trips/brazil" class="front">BRAZIL </a> | 
                <a href="/destinations/trips/zaragoza-bilbao" class="front">ZARAGOZA - BILBAO</a> | 
                <a href="/destinations/trips/japan" class="front">JAPAN</a>
            </td>
        </tr>
        <tr>
            <td height="50" colspan="10" valign="top">
                &nbsp;
            </td>
        </tr>
        <tr>
            <td valign="top">
                &nbsp;
            </td>
            <td colspan="3" valign="top">
                <a href="http://www.architravel.com/archipaper/" target="_blank" title="ArchiPaper"><img src="<?php echo get_template_directory_uri(); ?>/images/archipaper.jpg" alt="ArchiPaper" width="250" height="61" border="0"></a>
            </td>
            <td colspan="3" valign="center">
                <a href="http://www.architravel.com" target="_blank" title="ArchiTravel"><img src="http://www.architravel.com/destinations/wp-content/uploads/2016/06/ArchiTravel_LOGO.png" alt="ArchiTravel" width="250" height="68" border="10"></a>
                &nbsp;
            </td>
            <td valign="top">
                &nbsp;
            </td>
            <td valign="top">
                &nbsp;
            </td>
            <td valign="top">
                &nbsp;
            </td>
            <td valign="top">
                &nbsp;
            </td>
            <td valign="top">
                &nbsp;
            </td>
        </tr>
        </table>
    </td>
</tr>
</table>
<?php get_footer(); ?>

2 个答案:

答案 0 :(得分:0)

变化:

align="left"

为:

align="center"

在你的桌子上。

答案 1 :(得分:0)

为了确保它不能过度使用,我会在div中为它分配一个ID并对齐div。

<div id='table1'>
    <table>
    </table>
</div>

然后您可以使用

设置样式
#table1{
    text-align:none;
}