简体   繁体   English

PHP 不显示 div 的背景

[英]PHP doesn´t display div´s background

I´m trying to display a background of a div in PHP using echo, but the background doesn´t display我尝试使用 echo 在 PHP 中显示一个 div 的背景,但背景不显示

This is the PHP part:这是 PHP 部分:

    if($_GET['success'] == 1) {
        echo "<div class=\"form-result success\">Odeslání proběhlo v pořádku</div>";
    };

    if($_GET['success'] == -1) {
        echo "<div class=\"form-result error\">Chyba při odeslání. Zkuste to znovu.</div>";
    };

    ?>

This is the CSS part:这是 CSS 部分:

.form-result {
    width: 80%;
    margin: 0 auto;
    padding: 10px;
    margin-bottom: 20px;
    border-radius: 7px;
}

.success {
    background-color: #2d8c33;
}

.error {    
    background-color: rgb(185, 9, 9);
}

Thank you for help谢谢你的帮助

I tried your code and its perfectly working fine.我试过你的代码,它运行良好。 If you get the correct data in $_GET['success'] .如果您在$_GET['success']中获得正确的数据。 please, check the data you received in $_GET['success'] .请检查您在$_GET['success']中收到的数据。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM