php - CMS 表单无法根据 css 正确显示

标签 php html css

我正在使用一个 CMS 系统,它有一个用于生成表单的模板,带有预定义的 CSS。

正在使用的 CSS 文件是 here

我现在使用的表格是:

<div class="bodyline">
    <?php $theform->startForm($pageTitle)?>

    <div id="rightSideDiv">
        <fieldset>
            <legend><label for="report">Report</label></legend>
            <p>
                <?php $theform->showField("towel")?>
            </p>
        </fieldset>
    </div>

    <div id="leftSideDiv">
        <fieldset>
            <legend><label for="name">Info</label></legend>

            <p class="big"><?php $theform->showField("firstname"); ?></p>
            <p class="big"><?php $theform->showField("lastname"); ?></p>
            <p class="big"><?php $theform->showField("country"); ?></p>
            <p class="big"><?php $theform->showField("passport"); ?></p>
            <p class="big"><?php $theform->showField("email"); ?></p>
            <p class="big"><?php $theform->showField("roomnumber"); ?></p>
            <p class="big"><?php $theform->showField("hostel"); ?></p>
            <p class="big"><?php $theform->showField("checkin"); ?></p>
            <p class="big"><?php $theform->showField("checkout"); ?></p>
            <p class="big"><?php $theform->showField("locker"); ?></p>
            <p class="big"><?php $theform->showField("towel"); ?></p>
            <p class="big"><?php $theform->showField("tabno"); ?></p>

        </fieldset>

    </div>

</div>

这在理论上应该在左侧显示一个框,在右侧显示一个框。相反,rightSideDiv 显示在 leftSideDiv 的上方或下方,占据了表单的整个宽度。

生成的 HTML 是

<form action="/1/phpbms/modules/micro%20hospitality/guests_addedit.php?id=1" method="post" name="record" onsubmit="return validateForm(this);"><div id="dontSubmit"><input value=" " onclick="return false;" type="submit"></div>        <div id="topButtons"><div class="saveCancels"><input accesskey="s" title="Save (alt+s)" id="saveButton1" name="command" value="save" class="Buttons" type="submit"><input id="cancelButton1" name="command" value="cancel" class="Buttons" onclick="this.form.cancelclick.value=true;" accesskey="x" title="(access key+x)" type="submit"></div></div>
        <h1 id="h1Title"><span>Guests</span></h1>
    <div id="rightSideDiv">
        <fieldset>
            <legend><label for="report">Report</label></legend>
            <p>
                <input id="towel" name="towel" value="1" class="radiochecks" type="checkbox"> <label id="towelLabel" for="towel">Towel</label>          </p>

        </fieldset>
    </div>

    <div id="leftSideDiv">
        <fieldset>
            <legend><label for="name">Info</label></legend>

            <p class="big"><label for="firstname" class="important">First Name</label><br><input id="firstname" name="firstname" value="Jason" size="32" maxlength="64" class="important" type="text"></p>

        </fieldset>

    </div>

        </form>

现在,包含的表单可以正常工作,但我不明白为什么。

有效页面的包含表单代码:

<div class="bodyline">
    <?php $theform->startForm($pageTitle)?>

    <div id="rightSideDiv">
        <fieldset>
            <legend><label for="importance">importance / privacy</label></legend>
            <p>
                <?php $theform->showField("importance")?>
                <?php $theform->showField("private")?>
            </p>
        </fieldset>
    </div>

    <div id="leftSideDiv">
        <fieldset>
            <legend><label for="content">memo</label></legend>
            <p id="timeStampP">
                <button id="timeStampButton" type="button" class="graphicButtons buttonTimeStamp" accesskey="t" title="Add time stamp to memo (Access Key - t)">time stamp</button>
            </p>
            <p>
                <textarea name="content" cols="45" rows="23" id="content"><?php echo htmlQuotes($therecord["content"])?></textarea>
                <input id = "username" type="hidden" value="<?php echo formatVariable(trim($_SESSION["userinfo"]["firstname"]." ".$_SESSION["userinfo"]["lastname"]))?>" />
            </p>
        </fieldset>
    </div>

</div>

和生成的 HTML

<form action="/1/phpbms/modules/base/notes_addedit1.php" method="post" name="record" onsubmit="return submitForm(this)" id="record"><div id="dontSubmit"><input value=" " onclick="return false;" type="submit"></div>        <div id="topButtons"><div class="saveCancels"><input accesskey="s" title="Save (alt+s)" id="saveButton1" name="command" value="save" class="Buttons" type="submit"><input id="cancelButton1" name="command" value="cancel" class="Buttons" onclick="this.form.cancelclick.value=true;" accesskey="x" title="(access key+x)" type="submit"></div></div>
        <h1 id="h1Title"><span>Note/Task/Event</span></h1>

    <div id="rightSideDiv">
        <fieldset>
            <legend><label for="importance">importance / privacy</label></legend>
            <p>
                <select name="importance" id="importance"> <option value="3">Highest</option>

<option value="2">High</option>
<option value="1">Medium</option>
<option value="0" selected="selected">Normal</option>
<option value="-1">Low</option>
<option value="-2">Lowest</option>
</select>
                        <input id="private" name="private" value="1" class="radiochecks" checked="checked" type="checkbox"> <label id="privateLabel" for="private">private</label>          </p>
        </fieldset>

    </div>

    <div id="leftSideDiv">
        <fieldset>
            <legend><label for="content">memo</label></legend>
            <p id="timeStampP">
                <button id="timeStampButton" type="button" class="graphicButtons buttonTimeStamp" accesskey="t" title="Add time stamp to memo (Access Key - t)">time stamp</button>
            </p>

            <p>
                <textarea name="content" cols="45" rows="23" id="content"></textarea>
                <input id="username" value="Administrator" type="hidden">
            </p>
        </fieldset>
    </div>

        </form>

我描述的行为是否有任何原因?

最佳答案

leftSideDiv 没有 float 。在 css 中重新定义它或将其设置为内联样式:

float:left

http://phpbms.org/browser/trunk/phpbms/common/stylesheet/mozilla/pages/base/notes.css#L26

它还需要附加一个宽度,具体取决于容器的宽度。这可能会有所帮助:

http://www.smashingmagazine.com/2007/05/01/css-float-theory-things-you-should-know/

关于php - CMS 表单无法根据 css 正确显示,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3182494/

相关文章:

php - 为数据对象集合选择数据结构

php - 存储过程和mysql

html - html 5音频流伪造文件。渐进式下载,PCM WAV

php - 需要稍微改变表格的布局

html - 正确对齐社交按钮

css - 应用缩放 :80% to some browsers but not Internet Explorer

php - 为什么要上传 block 文件?

php - 在服务器端使用容器

html - 在鼠标悬停时仅向特定文本字段提供工具提示

javascript - 如何在 HTML 文件中分配图像