我试图设置所有echo语句的边界长度,以使它们的长度相同。现在,它们到达了我不需要的屏幕末端。我在每个语句使用内联样式的echo语句中执行此操作。谢谢
代码:
echo "<p><b>Your feedback request has been added into our system!</b></p>";
echo "<p><b>Your feedback request is as follows:</b></p>";
echo "<p style='border: 3px green ridge;'><b><u>Forename:</u></b> $forename <b><u>Surname:</u></b> $surname</p>";
echo "<p style='border: 3px green ridge;'><b><u>Postal Address:</u></b> $postalAddress</p>";
echo "<p style='border: 3px green ridge;'><b><u>Landline Tel No:</u></b> $landLineTelNo</p>";
echo "<p style='border: 3px green ridge;'><b><u>Mobile Tel No:</u></b> $mobileTelNo</p>";
echo "<p style='border: 3px green ridge;'><b><u>Email:</u></b> $email</p>";
echo "<p style='border: 3px green ridge;'><b><u>Send Method:</u></b> $sendMethod</p>";
echo "<p style='border: 3px green ridge;'><b><u>Category of Info:</u></b> $catID</p>";
// header('FeedbackRequest.html');
// exit;
}
答案 0 :(得分:0)
使用内联样式:将width
添加到每个定义中都应该做到这一点〜通过使用变量,可以在更改一次后更快地进行更改...有点像css'-)
$style='border: 3px green ridge; display:inline-block; width:100%';
/* an alternative */
# $style='border:3px green inset; display:block; width:calc( calc( 100% - 6px ) - 1rem ); float:none; padding:0.5rem; margin: 1rem auto;';
echo "<p><b>Your feedback request has been added into our system!</b></p>";
echo "<p><b>Your feedback request is as follows:</b></p>";
echo "<p style='{$style}'><b><u>Forename:</u></b> $forename <b><u>Surname:</u></b> $surname</p>";
echo "<p style='{$style}'><b><u>Postal Address:</u></b> $postalAddress</p>";
echo "<p style='{$style}'><b><u>Landline Tel No:</u></b> $landLineTelNo</p>";
echo "<p style='{$style}'><b><u>Mobile Tel No:</u></b> $mobileTelNo</p>";
echo "<p style='{$style}'><b><u>Email:</u></b> $email</p>";
echo "<p style='{$style}'><b><u>Send Method:</u></b> $sendMethod</p>";
echo "<p style='{$style}'><b><u>Category of Info:</u></b> $catID</p>";
答案 1 :(得分:-1)
div {
width: auto;
display: inline-block;
}
div > p {
border: 3px solid red;
width: 100%;
}
<div>
<p>
sasasasasasa
</p>
<p>
sasssssssssssssssssssssssssss
</p>
<p>
sasasas
</p>
</div>
尝试一下!