gpt4 book ai didi

html - 如何并排显示两个窗体

转载 作者:搜寻专家 更新时间:2023-10-31 22:32:24 24 4
gpt4 key购买 nike

我对 css 不是很了解,但我有以下 2 种形式:

    //below is where it displays course name

$outputcourse = "";
$outputcourse .= "<p><strong>Course:</strong> " . $course . " - " . $coursename . "</p>";

//below is where it displays module name

$outputmodule = "";
$outputmodule = sprintf("<p><strong>Module:</strong> %s - %s</p>", $moduleId, $moduleName);

//below is form where it displays assessments drop down menu

$assessmentform = "<form action='".htmlentities($_SERVER['PHP_SELF'])."' method='post'>
<p>{$outputcourse}</p>
<p>{$outputmodule}</p>
<p><strong>Assessments:</strong> {$sessionHTML} </p>
</form>";

echo $assessmentform;

}

//below is form where it displays all of the text inputs and submit button

$editsession = "<form id='updateForm'>

<p><strong>Current Assessment's Date/Start Time:</strong></p>
<table>
<tr>
<th>Assessment:</th>
<td><input type='text' id='currentAssessment' name='Assessmentcurrent' readonly='readonly' value='' /> </td>
</tr>
<tr>
<th>Date:</th>
<td><input type='text' id='currentDate' name='Datecurrent' readonly='readonly' value='' /> </td>
</tr>
<tr>
<th>Start Time:</th>
<td><input type='text' id='currentTime' name='Timecurrent' readonly='readonly' value=''/> </td>
</tr>
</table>
<div id='currentAlert'></div>

<p><strong>New Assessment's Date/Start Time:</strong></p>
<table>
<tr>
<th>Assessment:</th>
<td><input type='text' id='newAssessment' name='Assessmentnew' readonly='readonly' value='' /> </td>
</tr>
<tr>
<th>Date:</th>
<td><input type='text' id='newDate' name='Datenew' readonly='readonly' value='' /> </td>
</tr>
<tr>
<th>Start Time:</th>
<td><input type='text' id='newTime' name='Timenew' readonly='readonly' value=''/><span class='timepicker_button_trigger'><img src='Images/clock.gif' alt='Choose Time' /></span> </td>
</tr>
</table>
<div id='datetimeAlert'></div>

</form>

<p><button id='updateSubmit'>Update Date/Start Time</button></p>

<div id='targetdiv'></div>
";

echo $editsession;

CSS:

form#assessmentForm {
float: left;
border: 1px solid red;
}
form#updateForm {
float:left;
clear: right;
/* with some space to the left of the second form */
margin-right: 100px;
}
p#submitupdatebtn {
clear: both;
}

目前两种形式都显示在彼此之上。我真正想要做的是显示 $editsession 表单,显示在右侧的 $assessmentform 表单旁边,两个表单之间有一点空间。

如何实现?我希望它适用于所有主流浏览器。

下面显示了合并在一起的两个屏幕截图,以显示我希望它如何显示:

enter image description here

谢谢

更新:

下面是它现在显示的内容:

enter image description here

最佳答案

你只需要 float: left; 表格,建议也clear: right;第二种形式,这样其他 float 元素就不会出现在它的右边。最后,clear: both;<p> 上遵循第二种形式,因此前面的元素不会 float 到它的左侧或右侧。

form {
/* Float both forms to the left */
float: left;
/* borders added for visibility. Just remove them */
border: 1px solid red;
}
form#updateForm {
clear: right;
/* with some space to the left of the second form */
margin-right: 20px;
}
/* Give an id to the <p> which follows the second form and clear: both */
p#submit {
clear: both;
}

在您的标记中,给出 <p>它遵循第二种形式的 id,因此它可以很容易地在 CSS 中定位

<p id='submit'><button id='updateSubmit'>Update Date/Start Time</button></p>

然后将它移动到内部前面的<form>标记,因为它是该表单的一部分。

Here is a demonstration

关于html - 如何并排显示两个窗体,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13426948/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com