0

WordPress プラグインで使用されるフォームに 2 つの列を持つテーブルを作成しようとしています。これまでのところ、基本的なインデントを使用して右側の列をインデントしようとしましたが、最終結果は、右側の列が正確に垂直方向にインライン化されていない場所になります (テキスト ラベルのサイズが異なるためだと思います)。型テーブルを使用してみました<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 に答える