gpt4 book ai didi

php - 如何在 PHP echo 语句中使用内联样式显式设置边框长度?

转载 作者:行者123 更新时间:2023-11-28 15:07:11 25 4
gpt4 key购买 nike

我正在尝试设置所有 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;
}

最佳答案

使用内联样式:在每个定义中添加 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>";

关于php - 如何在 PHP echo 语句中使用内联样式显式设置边框长度?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55610804/

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