如果网站不可用或出于其他原因需要显示重要信息,我想在我的索引上发出警告信息。
这是我的CSS:
.warning-container {
margin:0 auto;
width:50%;
height:60px;
border:2px solid rgba(207,35,35, 0.5);
border-radius:7px;
background-color:rgba(255,61,61,0.3) !important;
padding:10px;}
.warning-icon {
width:60px;
float:left;}
.warning-h1 {
font-size:13px;
color:#c91b1b !important;
font-weight:bold;
float:left !important;}
.warning-message {
font-size:12px;
color:#e31a1a !important;
float:left;}
它将显示带有警告图标的红色背景以及警告和文本的标题。
php还不是100%,但这就是我得到的。
<center>
<?php
$conn = mysqli_connect("localhost", "root", "pass", "table");
$sql = "SELECT * FROM warning";
$result = $conn->query($sql);
//if(!empty("warning")){
// echo"";
//}else{
echo"<div class='warning-container'>";
echo "<img class='warning-icon' src='/warning-icon.png'>";
echo "<div class='warning-h1'>Warning:</div>";
echo "<div class='warning-message'>";
echo "<br/><br/>";
echo "
Warning message goes here!
";
echo"</div>";
echo"</div>";
//}
?>
</center>