0

我正在尝试在 WordPress 插件使用的表单上形成一个包含两列的表。到目前为止,我已经尝试使用基本缩进来缩进右侧列,但最终结果是右侧的列不完全垂直内联(我假设是因为文本标签的大小不同)。我曾尝试使用<td>类型表,但一切都变得疯狂。

我想使用如下代码,但似乎无法弄清楚该放在哪里:

<style type="text/css">
#wrap {
   width:600px;
   margin:0 auto;
}
#left_col {
   float:left;
   width:300px;

}
#right_col {
   float:right;
   width:300px;
}
</style>

<div id="wrap">
    <div id="left_col">
        ...
    </div>
    <div id="right_col">
        ...
    </div>
</div>

我用于表单的代码如下:

<?php
/*
If you would like to edit this file, copy it to your current theme's directory and edit it there.
Theme My Login will always look in your theme's directory first, before using this default template.
*/
?>
<div class="login" id="theme-my-login<?php $template->the_instance(); ?>">
    <?php $template->the_action_template_message( 'register' ); ?>
    <?php $template->the_errors(); ?>
    <form name="registerform" id="registerform<?php $template->the_instance(); ?>" action="<?php $template->the_action_url( 'register' ); ?>" method="post">

                <p style="float:left; padding-right:10px;"><label for="user_firstname<?php $template->the_instance(); ?>"><?php _e( 'First Name:', 'theme-my-login' ) ?></label></p>
                <p></p><input type="text" name="user_firstname" id="user_firstname<?php $template->the_instance(); ?>" class="input" value="<?php $template->the_posted_value( 'user_firstname' ); ?>" size="20" /></p>


                <p style="float:left; padding-right:10px;"><label for="user_lastname<?php $template->the_instance(); ?>"><?php _e( 'Last Name:', 'theme-my-login' ) ?></label></p>
                <p></p><input type="text" name="user_lastname" id="user_lastname<?php $template->the_instance(); ?>" class="input" value="<?php $template->the_posted_value( 'user_lastname' ); ?>" size="20" /></p>


                <p style="float:left; padding-right:40px;"><label for="user_email<?php $template->the_instance(); ?>"><?php _e( 'E-mail:', 'theme-my-login' ) ?></label></p>
                <p></p><input type="text" name="user_email" id="user_email<?php $template->the_instance(); ?>" class="input" value="<?php $template->the_posted_value( 'user_email' ); ?>" size="20" /></p>



                <p style="float:left; padding-right:10px;"><label for="user_tel<?php $template->the_instance(); ?>"><?php _e( 'Telephone:', 'theme-my-login' ) ?></label></p>
                <p></p><input type="text" name="user_tel" id="user_tel<?php $template->the_instance(); ?>" class="input" value="<?php $template->the_posted_value( 'user_tel' ); ?>" size="20" /></p>


                <p style="float:left; padding-right:35px;"><label for="user_mobile<?php $template->the_instance(); ?>"><?php _e( 'Mobile:', 'theme-my-login' ) ?></label></p>
                <p></p><input type="text" name="user_mobile" id="user_mobile<?php $template->the_instance(); ?>" class="input" value="<?php $template->the_posted_value( 'user_mobile' ); ?>" size="20" /></p>


                <p style="float:left; padding-right:30px;"><label for="user_country<?php $template->the_instance(); ?>"><?php _e( 'Country:', 'theme-my-login' ) ?></label></p>
                <p></p><input type="text" name="user_country" id="user_country<?php $template->the_instance(); ?>" class="input" value="<?php $template->the_posted_value( 'user_country' ); ?>" size="20" /></p>


                <p style="float:left; padding-right:15px;"><label for="user_login<?php $template->the_instance(); ?>"><?php _e( 'Username:', 'theme-my-login' ) ?></label></p>
                <p></p><input type="text" name="user_login" id="user_login<?php $template->the_instance(); ?>" class="input" value="<?php $template->the_posted_value( 'username' ); ?>" size="20" /></p>





<?php
do_action( 'register_form' ); // Wordpress hook
do_action_ref_array( 'tml_register_form', array( &$template ) ); //TML hook
?>
        <p id="reg_passmail<?php $template->the_instance(); ?>"><?php echo apply_filters( 'tml_register_passmail_template_message', __( 'A password will be e-mailed to you.', 'theme-my-login' ) ); ?></p>
        <p class="submit">
            <input type="submit" name="wp-submit" id="wp-submit<?php $template->the_instance(); ?>" value="<?php _e( 'Register', 'theme-my-login' ); ?>" />
            <input type="hidden" name="redirect_to" value="<?php $template->the_redirect_url( 'register' ); ?>" />
            <input type="hidden" name="instance" value="<?php $template->the_instance(); ?>" />
        </p>


    </form>
    <?php $template->the_action_links( array( 'register' => false ) ); ?>
</div>

我可以看到这确实是一个基本问题,但我已经尝试了几个小时并不断提出各种方式或疯狂。

谁能指出我正确的方向?请...?

我已更新到以下代码,但仍然无法正常工作:

<?php
/*
If you would like to edit this file, copy it to your current theme's directory and edit it there.
Theme My Login will always look in your theme's directory first, before using this default template.
*/
?>
<div class="login" id="theme-my-login<?php $template->the_instance(); ?>">
    <?php $template->the_action_template_message( 'register' ); ?>
    <?php $template->the_errors(); ?>
    <form name="registerform" id="registerform<?php $template->the_instance(); ?>" action="<?php $template->the_action_url( 'register' ); ?>" method="post">

<div id="regwrap">
    <div id="regleft_col">
        <p><label for="user_firstname<?php $template->the_instance(); ?>"><?php _e( 'First Name:', 'theme-my-login' ) ?></label></p>

    </div>
    <div id="regright_col">
        <p></p><input type="text" name="user_firstname" id="user_firstname<?php $template->the_instance(); ?>" class="input" value="<?php $template->the_posted_value( 'user_firstname' ); ?>" size="20" /></p>
    </div>
</div>




<?php
do_action( 'register_form' ); // Wordpress hook
do_action_ref_array( 'tml_register_form', array( &$template ) ); //TML hook
?>
        <p id="reg_passmail<?php $template->the_instance(); ?>"><?php echo apply_filters( 'tml_register_passmail_template_message', __( 'A password will be e-mailed to you.', 'theme-my-login' ) ); ?></p>
        <p class="submit">
            <input type="submit" name="wp-submit" id="wp-submit<?php $template->the_instance(); ?>" value="<?php _e( 'Register', 'theme-my-login' ); ?>" />
            <input type="hidden" name="redirect_to" value="<?php $template->the_redirect_url( 'register' ); ?>" />
            <input type="hidden" name="instance" value="<?php $template->the_instance(); ?>" />
        </p>


    </form>
    <?php $template->the_action_links( array( 'register' => false ) ); ?>
</div>
4

1 回答 1

0

您发布的 CSS 代码看起来不错,您只需在页面的 <head> 或style.css文件中插入 <style> 标签,然后在表单中插入 #wrap 即可。然后只需将 <p> 标记放在您希望它们成为的列上。

顺便说一句,我假设你得到的是表的东西。

于 2013-01-10T19:51:41.963 回答